How to obtain the window handle of a window

I would like the window of my Win32 application to have a fancy shape. The
SetWindowRegion API allows me to do that, but I need the window handle of
the window to be able to call it. Is there any way to obtain this window
handle?

Internally SDL uses SDL_Window but I have not been able to find any way to
get at it.

Huib-Jan

Huib-Jan Imbens wrote:

I would like the window of my Win32 application to have a fancy shape. The
SetWindowRegion API allows me to do that, but I need the window handle of
the window to be able to call it. Is there any way to obtain this window
handle?

Internally SDL uses SDL_Window but I have not been able to find any way to
get at it.

Huib-Jan

I thought that the whole point is that it’s cross-platform, and
therefore there’s no access to platform-specific stuff…

RK.

diff -c -r1.9 SDL_sysjoystick.c
*** SDL_sysjoystick.c 2002/06/12 03:30:58 1.9
— SDL_sysjoystick.c 2002/06/12 21:51:00***************
*** 69,75 ****
"‘Analog 2-axis 4-button 1-hat FCS joystick’ 2 1 0",
"‘Microsoft SideWinder Precision 2 Joystick’ 4 1 0",
"‘Logitech Inc. WingMan Extreme Digital 3D’ 4 1 0",
! “‘Saitek Saitek X45’ 6 1 0"
NULL
};
#else
— 69,75 ----
”‘Analog 2-axis 4-button 1-hat FCS joystick’ 2 1 0",
"‘Microsoft SideWinder Precision 2 Joystick’ 4 1 0",
"‘Logitech Inc. WingMan Extreme Digital 3D’ 4 1 0",
! “‘Saitek Saitek X45’ 6 1 0”,
NULL
};
#else

Steve Drach wrote:

diff -c -r1.9 SDL_sysjoystick.c
*** SDL_sysjoystick.c 2002/06/12 03:30:58 1.9
— SDL_sysjoystick.c 2002/06/12 21:51:00


*** 69,75 ****
"‘Analog 2-axis 4-button 1-hat FCS joystick’ 2 1 0",
"‘Microsoft SideWinder Precision 2 Joystick’ 4 1 0",
"‘Logitech Inc. WingMan Extreme Digital 3D’ 4 1 0",
! “‘Saitek Saitek X45’ 6 1 0"
NULL
};
#else
— 69,75 ----
”‘Analog 2-axis 4-button 1-hat FCS joystick’ 2 1 0",
"‘Microsoft SideWinder Precision 2 Joystick’ 4 1 0",
"‘Logitech Inc. WingMan Extreme Digital 3D’ 4 1 0",
! “‘Saitek Saitek X45’ 6 1 0”,
NULL
};
#else

I just want to point out a line from the development guidelines which
are found in the PHP project CVS, and I think it is better to adopt it
for other projects including SDL:
“Test your changes before committing them. We mean it. Really.”
:slight_smile:

Though I don’t really care if the code in the CVS will compile in every
given moment, since I only use the binaries anyway, I do think it is a
good practice to make sure the code compiles (by actually trying to
compile it) before commiting it…

RK.

I just want to point out a line from the development guidelines which
are found in the PHP project CVS, and I think it is better to adopt it
for other projects including SDL:
“Test your changes before committing them. We mean it. Really.”
:slight_smile:

Though I don’t really care if the code in the CVS will compile in every
given moment, since I only use the binaries anyway, I do think it is a
good practice to make sure the code compiles (by actually trying to
compile it) before commiting it…

hey, you know what? i agree! it was my fault. i’m sorry, what else can
i say? poop happens.–
jacob

Jacob L E Blain Christen wrote:

I just want to point out a line from the development guidelines which
are found in the PHP project CVS, and I think it is better to adopt it
for other projects including SDL:
“Test your changes before committing them. We mean it. Really.”
:slight_smile:

Though I don’t really care if the code in the CVS will compile in every
given moment, since I only use the binaries anyway, I do think it is a
good practice to make sure the code compiles (by actually trying to
compile it) before commiting it…

hey, you know what? i agree! it was my fault. i’m sorry, what else can
i say? poop happens.


jacob

That’s allright. It can happen to anyone…
It’s not a release that doesn’t compile, it’s just “bleeding-edge” CVS,
and it was already fixed, so it’s not terrible.
I’m sure you’ll be more carefull in the future. :slight_smile:
RK.

I would like the window of my Win32 application to have a fancy shape. The
SetWindowRegion API allows me to do that, but I need the window handle of
the window to be able to call it. Is there any way to obtain this window
handle?

Yes, you can use the system dependent API’s in SDL_syswm.h
There’s an example of using them here:
http://www.libsdl.org/projects/scrap/

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Yes, you can obtain it this way:

int r;
SDL_SysWMinfo info;
HWND hWnd;

SDL_VERSION(&(info.version));
r = SDL_GetWMInfo(&info);
if (r < 0) {
    fprintf(stderr, "%s", SDL_GetError());
    return -1;
}
hWnd = info.window;

I’d agree that SDL shall be cross-platform, but sometimes you just
need the trick :frowning:

Regards,
.paul.On Thu, Jun 13, 2002 at 12:38:51AM +0200, Romi Kuntsman wrote:

Huib-Jan Imbens wrote:

I would like the window of my Win32 application to have a fancy shape. The
SetWindowRegion API allows me to do that, but I need the window handle of
the window to be able to call it. Is there any way to obtain this window
handle?

Internally SDL uses SDL_Window but I have not been able to find any way to
get at it.

Huib-Jan

I thought that the whole point is that it’s cross-platform, and
therefore there’s no access to platform-specific stuff…

RK.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl