Preventing NeHe base code from window resize
Does anyone know how do I modify NeHe''s base code so that the user cannot change the window size during a non-fullscreen session?
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.
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
).
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

How do I set my laser printer on stun?
Thanks for the lead, Wildfire. It took some reading in the MSDN library, but I figured it out now.
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]
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]
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?
Plus, getting rid of the menu (with minimize,maximize buttons), won''t disable the user from resizing the window by dragging it''s borders?
How do I set my laser printer on stun?
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]
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.
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.
[edited by - Wildfire on August 9, 2003 11:16:54 AM]
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]
How do I set my laser printer on stun?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement