发信人: raeck(门框)
整理人: winsy(2003-03-05 16:35:20), 站内信件
|
如下代码可以关闭自动标题的窗口。
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
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const SW_SHOWNORMAL = 1
Const WM_CLOSE = &H10
Private Sub Command1_Click()
Dim WinWnd As Long, Ret As String, RetVal As Long
Ret = InputBox("在这里输入被关闭的窗口的标题:")
WinWnd = FindWindow(vbNullString, Ret)
If WinWnd = 0 Then MsgBox "Couldn't find the window ...": Exit Sub
ShowWindow WinWnd, SW_SHOWNORMAL
lpClassName = Space(256)
PostMessage WinWnd, WM_CLOSE, 0&, 0&
End Sub |
|