is there a win api function to hide a window? if you just know either the name or the handle?
Printable View
is there a win api function to hide a window? if you just know either the name or the handle?
Here is how to find the window by it's caption and then hide it:
Code:Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As
Long) As Long
Public Const SW_SHOW = 5
Public Const SW_HIDE = 0
h = FindWindow(vbNullString, "Calculator")
If h <> 0 Then
'To show the window again, change SW_HIDE to SW_SHOW
ShowWindow h, SW_HIDE
Else
MsgBox "Window was not found!", 16
End If