Results 1 to 10 of 10

Thread: show desktop or minimize all....

  1. #1

    Thread Starter
    Hyperactive Member Filter300's Avatar
    Join Date
    Aug 2001
    Posts
    413

    show desktop or minimize all....

    anyone know how to show the destop.. or minimize all windows? thru code? this on an XP machine....


  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Isn't there a key combo for minimizing all windows? Just find that combo, and use sendkeys... might work.
    -= a peet post =-

  3. #3

    Thread Starter
    Hyperactive Member Filter300's Avatar
    Join Date
    Aug 2001
    Posts
    413
    that is a great idea!.... thanks....

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    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...
    Last edited by peet; Sep 20th, 2002 at 11:39 AM.
    -= a peet post =-

  5. #5
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    API way....

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function FindWindow Lib "user32" Alias _
    4.     "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName _
    5.     As String) As Long
    6. Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
    7.     (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    8.     ByVal lParam As Long) As Long
    9.  
    10. Private Const WM_COMMAND As Long = &H111
    11. Private Const MIN_ALL As Long = 419
    12. Private Const MIN_ALL_UNDO As Long = 416
    13.  
    14. Public Sub MinimizeAll()
    15.  
    16.     Dim lngHwnd As Long
    17.    
    18.     lngHwnd = FindWindow("Shell_TrayWnd", vbNullString)
    19.     Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL, 0&)
    20.  
    21. End Sub
    22.  
    23. Public Sub RestoreAll()
    24.  
    25.     Dim lngHwnd As Long
    26.    
    27.     lngHwnd = FindWindow("Shell_TrayWnd", vbNullString)
    28.     Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL_UNDO, 0&)
    29.  
    30. End Sub
    31.  
    32. Private Sub cmdMinimize_Click()
    33.     MinimizeAll
    34. End Sub
    35.  
    36. Private Sub cmdRestore_Click()
    37.     RestoreAll
    38. End Sub
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  6. #6

    Thread Starter
    Hyperactive Member Filter300's Avatar
    Join Date
    Aug 2001
    Posts
    413
    thanks for the api Mc Brain works great!

  7. #7
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Originally posted by Filter300
    thanks for the api Mc Brain works great!
    welcome.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  8. #8
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    McBrain has already given you a good solution, but I feel bad about
    my stupid suggestion , so here goes... almost what I
    suggested

    VB Code:
    1. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    2. Const KEYEVENTF_KEYUP = &H2
    3. Const VK_LWIN = &H5B
    4.  
    5. Private Sub Command1_Click()
    6.    Call keybd_event(VK_LWIN, 0, 0, 0)
    7.    Call keybd_event(77, 0, 0, 0)
    8.    Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
    9. End Sub
    -= a peet post =-

  9. #9
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Originally posted by peet
    McBrain has already given you a good solution, but I feel bad about
    my stupid suggestion , so here goes... almost what I
    suggested

    VB Code:
    1. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    2. Const KEYEVENTF_KEYUP = &H2
    3. Const VK_LWIN = &H5B
    4.  
    5. Private Sub Command1_Click()
    6.    Call keybd_event(VK_LWIN, 0, 0, 0)
    7.    Call keybd_event(77, 0, 0, 0)
    8.    Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
    9. End Sub
    Don't feel bad... we still like you
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  10. #10
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    good
    -= a peet post =-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width