locked
show desktop RRS feed

  • Question

  • dear all

    when i press windows key and D key from keyboard automatic show desktop

    how can i create a button in my applucation having this action

    Monday, September 26, 2011 10:43 AM

Answers

  • I try with application who is maximized and modless.

    For me works.

    Try another code

    DECLARE INTEGER CloseWindow IN user32 INTEGER
    DECLARE INTEGER GetActiveWindow IN user32
    DECLARE INTEGER GetWindow IN user32 INTEGER, INTEGER
    DECLARE INTEGER GetWindowTextLength IN user32 INTEGER
    DECLARE INTEGER IsIconic IN user32 INTEGER
    DECLARE INTEGER IsWindow IN user32 INTEGER
    DECLARE INTEGER IsWindowVisible IN user32 INTEGER
    
    LOCAL nActive, nCounter, nHwnd, nIndex
    LOCAL cWindowCaption
    
    nCounter = 0
    nHwnd = -1
    
    nActive = GetActiveWindow()
    
    DO WHILE nHwnd != GetWindow(nActive, 1) &&1 = FIRST WINDOW
        IF nHwnd != -1
            nHwnd = GetWindow(nHwnd, 2) &&2 = NEXT WINDOW
        ELSE
            nHwnd = GetWindow(nActive, 0) &&0 = LAST WINDOW
        ENDIF
    
        IF GetWindowTextLength(nHwnd) > 0 AND IsWindow(nHwnd) != 0 AND IsWindowVisible(nHwnd) != 0
            nCounter = nCounter + 1
            DIMENSION aryWindows(nCounter)
            aryWindows(nCounter) = nHwnd
        ENDIF
    ENDDO
    
    FOR nIndex=1 TO nCounter
        If IsIconic(aryWindows(nIndex)) = 0
            IF CloseWindow(aryWindows(nIndex)) = 0
                *!* Non-existant window or something went wrong
            ENDIF
        ENDIF
    ENDFOR 



    Systems Analyst
    • Marked as answer by Kee Poppy Wednesday, October 5, 2011 3:13 AM
    Friday, September 30, 2011 7:37 PM

All replies

  • In click Event of the button put this code

    #DEFINE WM_COMMAND    0x111
    DECLARE INTEGER FindWindow IN user32 STRING, STRING
    DECLARE INTEGER SendMessage IN user32 INTEGER, INTEGER, INTEGER, INTEGER
    SendMessage(FindWindow("Shell_TrayWnd", NULL), WM_COMMAND, 415, 0) 



    Systems Analyst
    • Proposed as answer by Naomi N Monday, September 26, 2011 4:15 PM
    Monday, September 26, 2011 2:43 PM
  • i copy this code in my click action of button

    but

    when i press nothing happen

    Thursday, September 29, 2011 8:46 AM
  • What is the Windows Version?
    Systems Analyst
    Thursday, September 29, 2011 5:49 PM
  • window xp sp3
    Friday, September 30, 2011 8:22 AM
  • It works for me on XP SP3 (German). What does this code output for you?

    DECLARE INTEGER FindWindow IN user32 STRING, STRING
    ? FindWindow("Shell_TrayWnd", NULL)

    I get a large number, if this returns NULL or 0 for you, you must have some difference in Windows, perhaps because of your locale.

    Bye, Olaf.

    Friday, September 30, 2011 12:21 PM
  • it'get 65814

    be note that my application is maximize and modless

     

    Friday, September 30, 2011 2:17 PM
  • I try with application who is maximized and modless.

    For me works.

    Try another code

    DECLARE INTEGER CloseWindow IN user32 INTEGER
    DECLARE INTEGER GetActiveWindow IN user32
    DECLARE INTEGER GetWindow IN user32 INTEGER, INTEGER
    DECLARE INTEGER GetWindowTextLength IN user32 INTEGER
    DECLARE INTEGER IsIconic IN user32 INTEGER
    DECLARE INTEGER IsWindow IN user32 INTEGER
    DECLARE INTEGER IsWindowVisible IN user32 INTEGER
    
    LOCAL nActive, nCounter, nHwnd, nIndex
    LOCAL cWindowCaption
    
    nCounter = 0
    nHwnd = -1
    
    nActive = GetActiveWindow()
    
    DO WHILE nHwnd != GetWindow(nActive, 1) &&1 = FIRST WINDOW
        IF nHwnd != -1
            nHwnd = GetWindow(nHwnd, 2) &&2 = NEXT WINDOW
        ELSE
            nHwnd = GetWindow(nActive, 0) &&0 = LAST WINDOW
        ENDIF
    
        IF GetWindowTextLength(nHwnd) > 0 AND IsWindow(nHwnd) != 0 AND IsWindowVisible(nHwnd) != 0
            nCounter = nCounter + 1
            DIMENSION aryWindows(nCounter)
            aryWindows(nCounter) = nHwnd
        ENDIF
    ENDDO
    
    FOR nIndex=1 TO nCounter
        If IsIconic(aryWindows(nIndex)) = 0
            IF CloseWindow(aryWindows(nIndex)) = 0
                *!* Non-existant window or something went wrong
            ENDIF
        ENDIF
    ENDFOR 



    Systems Analyst
    • Marked as answer by Kee Poppy Wednesday, October 5, 2011 3:13 AM
    Friday, September 30, 2011 7:37 PM