anyone know how to show the destop.. or minimize all windows? thru code? this on an XP machine....
:confused:
Printable View
anyone know how to show the destop.. or minimize all windows? thru code? this on an XP machine....
:confused:
Isn't there a key combo for minimizing all windows? Just find that combo, and use sendkeys... might work. :)
that is a great idea!.... thanks....
errhmmm... forget what I said... the combination is Windows function key (the flag key) and M
don't think you can sendkey that special win key... :(
API way....
VB Code:
Option Explicit 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, _ ByVal lParam As Long) As Long Private Const WM_COMMAND As Long = &H111 Private Const MIN_ALL As Long = 419 Private Const MIN_ALL_UNDO As Long = 416 Public Sub MinimizeAll() Dim lngHwnd As Long lngHwnd = FindWindow("Shell_TrayWnd", vbNullString) Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL, 0&) End Sub Public Sub RestoreAll() Dim lngHwnd As Long lngHwnd = FindWindow("Shell_TrayWnd", vbNullString) Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL_UNDO, 0&) End Sub Private Sub cmdMinimize_Click() MinimizeAll End Sub Private Sub cmdRestore_Click() RestoreAll End Sub
thanks for the api Mc Brain works great!
welcome.Quote:
Originally posted by Filter300
thanks for the api Mc Brain works great!
McBrain has already given you a good solution, but I feel bad about
my stupid suggestion :eek:, so here goes... almost what I
suggested :D
VB Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Const KEYEVENTF_KEYUP = &H2 Const VK_LWIN = &H5B Private Sub Command1_Click() Call keybd_event(VK_LWIN, 0, 0, 0) Call keybd_event(77, 0, 0, 0) Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0) End Sub
Don't feel bad... we still like you ;)Quote:
Originally posted by peet
McBrain has already given you a good solution, but I feel bad about
my stupid suggestion :eek:, so here goes... almost what I
suggested :D
VB Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Const KEYEVENTF_KEYUP = &H2 Const VK_LWIN = &H5B Private Sub Command1_Click() Call keybd_event(VK_LWIN, 0, 0, 0) Call keybd_event(77, 0, 0, 0) Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0) End Sub
good :)