Jump to content

Recommended Posts

Posted

I'm having a strange problem with window styles. I create a window with the WS_CHILD, WS_POPUP and WS_VISIBLE styles using CreateWindowEx(), and it works fine. However, if I later add the WS_BORDER style using SetWindowLong(), nothing happens. Spy++ shows that it has the WS_BORDER style, but there is no border. Similarly, if I create it with the WS_BORDER style, a border is drawn, but it won't disappear if I remove the style. The window is completely erased and redrawn about once per second so I don't think it's a drawing problem. :blink:


Posted

From MSDN...

Certain window data is cached, so changes you make using SetWindowLong will not take effect until you call the SetWindowPos function. Specifically, if you change any of the frame styles, you must call SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be updated properly.

A call to SetWindowPos and it should be fixed.

:hello:

Posted (edited)

Thanks, I must have missed that. :P

Another problem, though. After I change the style, the WS_EX_NOACTIVATE style no longer applies, even if I set it again after I change the style. Just like with the border, the style is set but the window can still be activated (though before changing the style, it can't, as is expected). It doesn't seem to make a difference whether I call SetWindowPos before or after re-applying the extended style.

Also how do you reserve an area of the screen? Like wherever you place the taskbar, that area is excluded from the work area; a maximized window won't occupy that space. I want to reserve space like that, but not actually put a window in it. I know this can be done because if I terminate Explorer in Safe Mode (in normal mode it respawns) the space reserved for the taskbar is still reserved until I start Explorer again, and I can drag windows into it and see my desktop but if I maximize a window, they act like the taskbar was still there.

[edit] Wow, reserving screen space is easier than I expected.

RECT rect;
SystemParametersInfo(SPI_GETWORKAREA,0,&rect,0);
//modify the rect however
SystemParametersInfo(SPI_SETWORKAREA,0,&rect,0);

Edited by HyperHacker

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...