Results 1 to 6 of 6

Thread: How to find out if a foreign window is minimizable

  1. #1

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Question

    I'm working on a screensaver which minimizes all windows and then plays around with the desktop icons.

    The problem is, that if I minimize a window which isn't minimizable, the window is resized to it's minimum size and positioned at the bottom of the desktop, and when I try to maximize or restore the window, it's size and position isn't restored. I need to activate it and press the enter button to restore the original size.

    How can I find out if this window is not minimizable (or doesn't have a minimize button), so I can restore it to it's original size afterwards?


  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    GetWindowLong API for this one.

    here's some constants

    Code:
    Private Const WS_MINIMIZEBOX = &H20000
    Private Const WS_MAXIMIZEBOX = &H10000
    Private Const GWL_STYLE = (-16)
    if you need to know wheather a window can be minimized use

    Code:
    cBool(GetWindowLong(hWnd, GWL_STYLE) And WS_MINIMIZEBOX)
    you could probably use setwindowlong to let it be minimized, I;m not sure but try

    Code:
    SetWindowLong hWnd, GWL_STYLE,GetWindowLong(hWnd, GWL_STYLE) Or WS_MINIMIZEBOX) ' Turns minimizebox on
    
    SetWindowLong hWnd, GWL_STYLE,GetWindowLong(hWnd, GWL_STYLE) And (Not( WS_MINIMIZEBOX)) ' Turns minimizebox on
    Hope this Helps

  3. #3

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Thanks,

    The GetWindowLong works, but I can't get the SetWindowLong to work.
    I think there are conflicting settings with the extended style bits. The windows I tested had a DS_MODALFRAME style bit set, and also a WS_EX_DLGMODALFRAME extended style. I can't change them, SetwindowLong always returns 0.
    I think I let it this way, and try to restore the RECT.

  4. #4

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    In case anyone is interested, restoring the size didn't work. I managed to get it back in original state by sending a WM_SYSCOMMAND message with SC_RESTORE as wParam.

  5. #5

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I am actually to embarrassed to admit this. But all was just a mistake in my code I overlooked.
    I used ShowWindow to minimize the windows.
    To restore the windows, I used ShowWindow again with for previously maximized windows SW_MAXIMIZE,
    but for previously normal windows I made a copy and paste error.
    Instead of using SW_NORMAL or SW_RESTORE I used SW_MINIMIZE again. Of course this didn't work, and for some reason I kept overlooking this mistake.

  6. #6
    Lively Member
    Join Date
    Apr 2000
    Location
    Hell
    Posts
    89

    Cool

    Question...if you're trying to play around with the desktop icons, why don't you just *HIDE* all the windows (make sure you remember which ones, so you don't unhide a window you shouldn't)?
    - Steve

    Real programmers use COPY CON PROGRAM.EXE

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