ZFGC

Resources => Coding => Topic started by: sjegtp on February 26, 2009, 05:46:52 pm

Title: [Solved][C++] Position of the window?
Post by: sjegtp on February 26, 2009, 05:46:52 pm
How can I set the starting position of the window of the program?
I'm using C++ with SDL.
Title: Re: [C++] Position of the window?
Post by: MG-Zero on February 27, 2009, 04:25:44 am
There's a parameter for it in the CreateWindowEx() function.  Parameter 5 is the x position, and 6 is the y position.
Title: Re: [C++] Position of the window?
Post by: sjegtp on February 27, 2009, 12:19:02 pm
Hmm... the problem is that SDL creates the window automatically for you, so if I call this function I'll end up creating another window.
Is there a way to modify the x and y values after the window was created?

EDIT: Never mind, I *finally* found it at google.
Code: [Select]
SDL_SysWMinfo i;
SDL_VERSION( &i.version );
if ( SDL_GetWMInfo ( &i) ) {
  HWND hwnd = i.window;
  SetWindowPos( hwnd, HWND_TOP, x, y, width, height, flags );
}
Title: Re: [C++] Position of the window?
Post by: Windy on February 27, 2009, 12:25:34 pm
http://sdl.beuc.net/sdl.wiki/SDL_envvars
needs to be set before you init the window.
Title: Re: [C++] Position of the window?
Post by: sjegtp on February 27, 2009, 12:51:51 pm
Thanks Windy.
I just tried that now, but the previous code worked better.

Anyway, problem solved.

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved