-
I am trying to use API DestroyWindow
to auto close an active window.
in a timer,
Dim hwnd as long
hwnd=GetforegroundWindow
call DestroyWindow(hwnd)
It does not work, but if use CloseWindow
in place of DestroyEindow, it works except
it just minimizes the wind.
Do I miss something?
Thanks for any help.
-
Use the PostMessage API... for instance:
Code:
Private Declare Function GetForegroundWindow Lib "user32" () 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 Const WM_CLOSE = &H10
Private Sub Command1_Click()
hWndForeground = GetForegroundWindow()
Call PostMessage(hWndForeground, WM_CLOSE, 0&, 0&)
End Sub
------------------
Tom Young, 14 Year Old
[email protected]
ICQ: 15743470
AIM: TomY10
PERL, JavaScript and VB Programmer