Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Solved][C++] Position of the window?  (Read 1444 times)

0 Members and 1 Guest are viewing this topic.
[Solved][C++] Position of the window?
« on: February 26, 2009, 05:46:52 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1141
How can I set the starting position of the window of the program?
I'm using C++ with SDL.
« Last Edit: February 27, 2009, 12:52:09 pm by sjegtp »
Logged
Re: [C++] Position of the window?
« Reply #1 on: February 27, 2009, 04:25:44 am »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
There's a parameter for it in the CreateWindowEx() function.  Parameter 5 is the x position, and 6 is the y position.
Logged



i love big weenies and i cannot lie
Re: [C++] Position of the window?
« Reply #2 on: February 27, 2009, 12:19:02 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1141
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 );
}
« Last Edit: February 27, 2009, 12:41:35 pm by sjegtp »
Logged
Re: [C++] Position of the window?
« Reply #3 on: February 27, 2009, 12:25:34 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
http://sdl.beuc.net/sdl.wiki/SDL_envvars
needs to be set before you init the window.
Logged
Re: [C++] Position of the window?
« Reply #4 on: February 27, 2009, 12:51:51 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1141
Thanks Windy.
I just tried that now, but the previous code worked better.

Anyway, problem solved.
Logged
Pages: [1]   Go Up

 


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



Page created in 0.056 seconds with 47 queries.