I came across this problem in a recent project I was working on....Does anyone know how to do it?
Printable View
I came across this problem in a recent project I was working on....Does anyone know how to do it?
There should be good samples on my homepage, i'm not sure i put up that one with hiding and showing, but you put this in the same module
Code:Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Property Get Windowvisible(hwnd&) As Boolean
clockvisible = IsWindowVisible(hwnd)
End Property
Property Let Windowvisible(hwnd&,newvalue As Boolean)
ShowWindow hwnd, newvalue * -5
End Property
Here's a good code I used for my program:
Hope that helps.Code:Declare Function findwindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public 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
Declare Function showWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) 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
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
Private Const WM_COMMAND As Long = &H111
Private Const MIN_ALL As Long = 419
Private Const MIN_ALL_UNDO As Long = 416
'Hide
Dim progman&
Dim shelldlldefview&
Dim syslistview&
progman& = FindWindow("progman", vbNullString)
shelldlldefview& = FindWindowEx(progman&, 0&, "shelldll_defview", vbNullString)
syslistview& = FindWindowEx(shelldlldefview&, 0&, "syslistview32", vbNullString)
tray& = findwindow("Shell_TrayWnd")
X = showWindow(syslistview&, SW_HIDE)
Y = showWindow(tray&, SW_HIDE)
-----
'Show
Dim progman&
Dim shelldlldefview&
Dim syslistview&
progman& = FindWindow("progman", vbNullString)
shelldlldefview& = FindWindowEx(progman&, 0&, "shelldll_defview", vbNullString)
syslistview& = FindWindowEx(shelldlldefview&, 0&, "syslistview32", vbNullString)
tray& = findwindow("Shell_TrayWnd")
Y = showWindow(syslistview&, SW_SHOW)
X = showWindow(tray&, SW_SHOW)
'To minimize any window that remains..:
Public Sub MinimizeAll()
On Error Resume Next
Dim lngHwnd As Long
lngHwnd = findwindow("Shell_TrayWnd", vbNullString)
Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL, 0&)
End Sub
'Restore all windows:
Public Sub RestoreAll()
Dim lngHwnd As Long
lngHwnd = findwindow("Shell_TrayWnd", vbNullString)
Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL_UNDO, 0&)
End Sub
'Restore your program only:
Public Sub RestoreMe()
Dim i
Dim lngHwnd As Long
i = hWnd 'form's hWnd
lngHwnd = findwindow(i, vbNullString)
Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL_UNDO, 0&)
End Sub
[Edited by Matthew Gates on 06-11-2000 at 10:42 PM]