簡易的使用VB6 達成關閉指定視窗!!
教學開始:
將以下程式碼貼入VB裡面即可
宣告:
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, lParam As Any) As Long ' By - 六月雪 Const WM_CLOSE = &H10 '擷自 http://bps1331.blogspot.tw
程式碼:
Dim Hwnd As Long Hwnd = FindWindow(vbNullString, Text1.Text) PostMessage Hwnd, WM_CLOSE, 0, 0&
教學完畢
歡迎有需要者拿去參考,但不可將名字改一改拿去賣喔 ^_^
沒有留言:
張貼留言