ActiveX and the infamous SDL_WINDOWID

I’m trying to make my games run in a browser with as few changes as
possible, ideally none.

I created a simple ActiveX control that calls CreateProcess() on my game
EXE, passing the HWND as a string in the command line. The game gets the
HWND correctly.

Now my troubles start. I couldn’t get SDL to recognize the SDL_WINDOWID
variable using putenv(). I used SetEnvironmentVariable() and modified
SDL to use GetEnvironmentVariable(), and this worked. I guess this is
because the different environments in the ActiveX, the game and the SDL
DLL. Is there a reason not to use {Get,Set}EnvironmentVariable() in
Windows? I think this has been already done in CVS for the
SDL_VIDEODRIVER; can it be done for SDL_WINDOWID as well? I got it
working, I can send a patch.

Once this is done, the game does run inside the window passed by the
ActiveX control, but I don’t get any keyboard or mouse input. Any ideas?
In a previous state of debugging I had SDL create a separate window
(SDL_WINDOWID wasn’t working) but initialized Direct3D to use the
ActiveX window; in this case graphics were rendered to the ActiveX
window but input was read from the SDL window. Shouldn’t SDL_WINDOWID
cause SDL to “own” the input from the ActiveX window? Should I do
anything special in the ActiveX control?

Speaking of SDL_WINDOWID, is there any plan to make this and other
features such as VIDEODRIVER less of a hack? Something like
SDL_SetWindowID(void* handle)?

Thanks in advance,


Gabriel Gambetta
Mystery Studio -
Gabriel on Graphics -