HyperHacker Posted September 26, 2005 Share Posted September 26, 2005 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. Link to comment Share on other sites More sharing options...
jdoe Posted September 27, 2005 Share Posted September 27, 2005 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. Link to comment Share on other sites More sharing options...
HyperHacker Posted September 27, 2005 Author Share Posted September 27, 2005 (edited) Thanks, I must have missed that. 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 howeverSystemParametersInfo(SPI_SETWORKAREA,0,&rect,0); Edited October 1, 2005 by HyperHacker Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now