-
private declare function findwindows lib "user32" alias "findwindowa" (byval lpclassname as string, byval lpwindowname as string) as long
private declare function postmessage lib "user32" alias "postmessagea" (byval hwnd as long, byval wmsg as long, byval wparam as long, lparam as any) as long
private const wm_close = &h10
private sub command1_click()
winhwnd = findwindows("Windows 任务管理器", vbnullstring) '知道窗口类名称,关闭。
winhwnd = findwindows(vbnullstring, "microsoft word") '知道窗口标题,关闭。
call postmessage(winhwnd, wm_close, 0&, 0&)
end sub
-
**如下。
我将使用计算器程序作为示例进行演示。
option explicit
private enum wm_
wm_close = &h10
end enum
private declare function findwindow lib "user32" alias "findwindowa" (byval lpclassname as string, byval lpwindowname as string) as long
private declare function postmessage lib "user32" alias "postmessagea" (byval hwnd as long, byval wmsg as wm_, byval wparam as long, byval lparam as long) as long
private sub form_click() '单击表单以查看效果。
dim hcalc as ole_handle
hcalc = findwindow("scicalc", vbnullstring) '有关此参数的详细信息,请参阅问题末尾的参考资料。
postmessage hcalc, wm_close, 0, 0
end sub
private sub form_load() '程序运行时,打开计算器。
shell "calc"
end sub
-
首先:在 cmd 中使用 taskkill 终止程序。
shell “cmd c taskkill f im 进程的名称。 exe“
第二种类型:(win7)以下即可使用,使用NTSD结束程序。
shell 的进程名称“cmd c ntsd -c q -pn user. exe“
if dir( &") then '检测是否存在 app1 = loadresdata(101,"custom"如果为空,则读取 (101,"custom") 字符串。 >>>More
先说吧,这要看你以后选择的专业,我学的是土木工程。 专业不同,有时学习不同,我所看到的,土木工程、建筑、化工等都是VB。 >>>More