Skip to main content
gamedev.net
🔒 Locked

beginner problem with a window...

Started by chris1234 3 replies 350+ views
Original Post
chris1234
chris1234
as said in my last post...I want to resize my window...so I use SetWindowPos() to resize my window but nothing happens the window still stays the same size and at the same position...also included ShowWindow() ''cause reading the sdk docs I thought you needed that function to activate any changes made to the window but still my window remains unchanged...what do I need to do before my window finally changes it''s size and position on screen? anyone? Chris
Oluseyi
Oluseyi
What flags did you pass to it? If the SWP_SHOWINDOW or SWPHIDEWINDOW flag is set, the window can not be moved or sized.
chris1234
chris1234
I used the flag SWP_SHOWWINDOW...but even without it (using NULL) it won''t resize

I use the 2 functions with these parameters to try and get them working...

SetWindowPos(hwnd, hwnd, 200, 100,400, 500, NULL;
ShowWindow(hwnd, SW_SHOW);

Chris
Oluseyi
Oluseyi
It would appear that your problem is specifying hwnd as both first and second parameters. Nowhere in the docs do I see anything of this form... Try this instead:
SetWindowPos(hwnd, HWND_TOP, 200, 100, 400, 500, NULL); 
Advanced Bug
Advanced Bug
There is also another API function for resizing window -MoveWindow. For example:

MoveWindow(handMain, x, y, width, height, TRUE);

If the last parameter is TRUE, window automatically receives the WM_PAINT message so you don''t need to call ShowWindow.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.