Jump to content
  • Advertisement

Archived

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

Whelzorn

basic windows...

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

ok, there are some things I need to know about writing applications. My first major one, is how do you stop a window from being resizeable? (btw. im using win32) and second, how do I make a window center in the middle of the screen (need to consider difft. screen sizes/resolutions) if anyone knows, i would greatly appreciate some help on this. thanks, -whelzorn [edited by - Whelzorn on February 27, 2004 3:20:12 PM]

Share this post


Link to post
Share on other sites
Advertisement
...maybe a shot in the dark...

when you create the window ...

hwnd = createwindow( bla bla bla, some place here you specify the window''s x,y coord, and the height/width of the window ... set it to a number )

in this way the window will keep its width/height ... try that ...

Share this post


Link to post
Share on other sites
Check the Win32 API for CreateWindowEx() and especially the window styles there (for the non-resizing window -problem).

You must not use any styles with WS_THICKFRAME (such as WS_OVERLAPPEDWINDOW) as it will make the window resizeable.

To get the screen size, use GetSystemMetrics(). To create a non-resizeable centered window, you could do:

int screen_width = GetSystemMetrics (SM_CXSCREEN);
int screen_heigth = GetSystemMetrics (SM_CYSCREEN);

int win_x = screen_width/2 - win_width/2;
int win_y = screen_heigth/2 - win_heigth/2;

CreateWindowEx (0, "MyClass", "MyTitle", WS_VISIBLE | WS_OVERLAPPED | WS_SYSMENU,
win_x, win_y, win_width, win_heigth, 0, 0, instance, 0);


EDIT: Modified a lot

[edited by - nonpop on February 27, 2004 3:21:21 PM]

Share this post


Link to post
Share on other sites
Erm, you can always choose a window style that doesn''t include WS_THICKFRAME or WS_BORDER styles. e.g. WS_POPUP | WS_CAPTION | WS_SYSMENU - should work.

Jans.

Share this post


Link to post
Share on other sites
Thanks alot for responding!
ok, Jansic, I used WS_SYSMENU. It worked perfectly!
Nonpop, i diddnt know which styles had WS_THICKFRAME, but I guess WS_SYSMENU diddnt, because it worked, and your code example is being used (the top left corner is what the window location relies on, so it had to be divided by 3[edit not 4], not 2), and works fine. Thank you everyone who responded!

[edit: forgot stuff]

[edited by - Whelzorn on February 27, 2004 4:17:13 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!