-
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?
-
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
-
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.
-
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.
-
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.
-
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)?