vb 关闭窗口

简介: 引用:http://tieba.baidu.com/f?kz=622302614 Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpW...

引用:http://tieba.baidu.com/f?kz=622302614

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 Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long


Private closeWin As New Class1
Private Const wm_close = &H10
Private b As Integer


Private Sub Command1_Click()
'a = FindWindow(vbNullString, "我的电脑")
a = FindWindow(vbNullString, "Internet Explorer 无法显示该网页 - Windows Internet Explorer")'里面是窗口的标题
PostMessage a, wm_close, 0, 0

End Sub

相关文章
|
数据安全/隐私保护
VB—登录窗体
 说到登录,大家应该都了解登录就是输入ID、密码进入程序,密码不对就会重新登录,甚至多次输入错误还会锁定,这里用到了限制错误次数,输入错误次数超过3次就强制退出系统。
62 0
VB—登录窗体
分享:如何在VB中添加鼠标滚轮
分享:如何在VB中添加鼠标滚轮
零基础VB教程036期:如何正确使用picturebox控件?
零基础VB教程036期:如何正确使用picturebox控件?
189 0
自己编写vb进度条控件
自己编写vb进度条控件
225 0
自己编写vb进度条控件
VB编程:ReleaseCapture&SendMessage拖动无标题栏的窗体-57
VB编程:ReleaseCapture&SendMessage拖动无标题栏的窗体-57
VB编程:ReleaseCapture&SendMessage拖动无标题栏的窗体
VB编程:ReleaseCapture&SendMessage拖动无标题栏的窗体
175 0
VB编程:ReleaseCapture&SendMessage拖动无标题栏的窗体
VB控件在C#中的使用
VB控件在C#中的使用
535 0