[SDL] How to move window with SDL

Tankko Omaskio tankko at gmail.com
Mon Jun 13 12:33:56 PDT 2005


I tried this with no luck, but it was a quick test, so I might not
have filled everything out correctly for the struct/flags.

Tankko

On 6/13/05, Donny Viszneki <smirk at thebuicksix.com> wrote:
> 
> On Jun 13, 2005, at 12:55 PM, Tankko Omaskio wrote:
> 
> > I can only speak from Windows experience, but there is no easy way to
> > move or position the window from within your code.
> 
> Tankko is not correct (I think.) It should be very easy to do on
> windows. Observe:
> 
> #ifdef WIN32
> /* Declare our "system window manager info" structure for retrieving
> window manger system information, and a window handle */
> HWND hwnd;
> SDL_SysWMInfo info;
> 
> /* The info structure requires us to tell the runtime environment what
> version of SDL we're compiling with before we can SDL_GetWMInfo, so we
> use a preprocessor macro, which will fill out info.version with
> constants defined at build-time. I assume this is because the info
> structure changes from version to version (can anyone back me up on
> this?) */
> SDL_VERSION(&info.version);
> if (SDL_GetWMInfo(&info))
> {
>      hwnd = info->window;
>      SetWindowPos(hwnd, x, y, width, height, FLAGS);
> }
> #endif/*WIN32*/
> 
> Rohit, you may have to set some FLAGS. For more information on those,
> read the MSDN documentation for this function:
> 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/
> winui/windowsuserinterface/windowing/windows/windowreference/
> windowfunctions/setwindowpos.asp
> 
> There is a possibility that this function isn't known to work, and that
> Tankko is way ahead of me. I haven't personally done this, but I've had
> extensive experience with Windows API programming, and I just dredged
> up the rest by taking a brief look at the SDL source code.
> 
> Let me know if it works Rohit.
>




More information about the SDL mailing list