Jump to content
  • Advertisement
Sign in to follow this  
JimPrice

Dynamically changing styles from CreateWindowEx

This topic is 5093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, When creating a window using CreateWindowEx you specify a dwExstyle and a dwstyle. I'd like to be able to change my dwstyle from WS_OVERLAPPEDWINDOW to WS_POPUP and back again on the fly - that is, a key stroke allows the program to change between the 2 styles once it is running. I'm fairly sure that SetWindowLong doesn't allow you to do this - it only allows changing a limited set of the style parameters. Does anyone know of anyway of doing (or appearing to do) this, or am I on a hiding to nothing? Regards, Jim.

Share this post


Link to post
Share on other sites
Advertisement
After using SetWindowLong, do you call SetWindowPos so the cached window data is refreshed?

Share this post


Link to post
Share on other sites
Yeah, I've tried this but it just seems to crash the program - the first example I tried was just adding an HSCROLL when you pressed the space button, but it seems to relegate the target window to be underneath everything else.

Thanks,
Jim.

Share this post


Link to post
Share on other sites
To clarify that last point, in my CALLBACK procedure I'm using:


case VK_SPACE:

SetWindowLong(hwnd, GWL_STYLE, dwStyle | WS_HSCROLL);
SetWindowPos(
hwnd,
HWND_TOPMOST,
0,
0,
400,
300,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);

return 0;
[\source]

Share this post


Link to post
Share on other sites
I thought SetWindowLongPtr was just the same as SetWindowLong, except it is compatible with 32 and 64 bit systems - in which case it wouldn't address the issue. I'll have a go though.

Thanks,
Jim.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!