Archived

This topic is now archived and is closed to further replies.

Preventing NeHe base code from window resize

This topic is 5238 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

I meant I don''t want the user to drag and resize the window, not preventing the toggle of fullscreen and non-fullscreen. If my window is default at 640x480, I don''t want the user to click and drag the bottom corner of the window and change the window size to 2x2 or 800x800 etc.

Share this post


Link to post
Share on other sites
Take a look at the CreateWindowEx function.

There are two parameters, dwStyle and dwExStyle. With the right combination you''ll get whatever you want.

WS_EX_APPWINDOW, and WS_POPUP for example will give you a window without border, caption etc. So the user can''t even press the [X] to close the application (because there isn''t one ).

Share this post


Link to post
Share on other sites
Heres the easiest way:
HMENU hMENU = GetSystemMenu(hWnd, 0);
DeleteMenu(hMENU, 0xf000, 0x0);

Then if you want to get rid of the maximize button, just add this:
WindowStyle = YourWindowStyle;
WindowStyle &= ~WS_MAXIMIZEBOX;
CreateWindow(*);

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"

[edited by - UltimaX on August 8, 2003 12:19:16 AM]

Share this post


Link to post
Share on other sites
In what way is that easier then what I said? There''s no need to delete the menu, if you don''t create it in the first place. And changing a few parameters in the CreateWindow function is far from difficult.

Plus, getting rid of the menu (with minimize,maximize buttons), won''t disable the user from resizing the window by dragging it''s borders?

Share this post


Link to post
Share on other sites
quote:
Original post by Wildfire
In what way is that easier then what I said? There's no need to delete the menu, if you don't create it in the first place. And changing a few parameters in the CreateWindow function is far from difficult.

Plus, getting rid of the menu (with minimize,maximize buttons), won't disable the user from resizing the window by dragging it's borders?


What if he wanted a window with a frame?

Getting rid of the size menu will prevent the user from resizing the window with the border. Try it. Getting rid of the maximize button will prevent the user from maximizing the window. (Obviously)

You gave him an idea for getting rid of the window frame, I gave him an idea without getting rid of the window frame. Its not a big deal.

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"

[edited by - UltimaX on August 9, 2003 10:04:53 AM]

Share this post


Link to post
Share on other sites
I was only giving a few example parameters. With the right parameters you get a window with a frame, a system menu (including the [x]), and a non-resizable border. You can restrict the window to 'minimizable only' as well, for example.

quote:
Getting rid of the size menu will prevent the user from resizing the window with the border. Try it.

Ok, this does work, but it's confusing. On my system (WinXP Pro), I still get the same border as before and the cursor changes into the resize arrows, but I can't resize. I think this'll thoroughly confuse the users of your programm.

quote:
Getting rid of the maximize button will prevent the user from maximizing the window. (Obviously)


[edited by - Wildfire on August 9, 2003 11:16:54 AM]

Share this post


Link to post
Share on other sites