WindowHack problem in Windows XP and wxWidgets

Hello,

I try to use the Windows Hack trick to avoid the opening of a new window
when I use SDL.
I am working with VC6 and wxWidgets 2.8.0. My application main dialog is a
wxFrame. I’m working over Windows XP.
When I call SDL_Init with SDL_WINDOWID set it fails reporting the
following error:

Couldn’t get user specified window

Here is my code:

char windowHack[256] = {0};
//sprintf(windowHack, “SDL_WINDOWID=%ld”, m_lWindowId);
sprintf(windowHack, “SDL_WINDOWID=0x%.8x”, m_lWindowId);
//putenv(windowHack);
SDL_putenv(windowHack);

int flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;

if (SDL_Init (flags))
{

I have also tried the following:

char windowHack[256] = {0};
sprintf(windowHack, “SDL_WINDOWID=%ld”, m_lWindowId);
putenv(windowHack);

int flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;

if (SDL_Init (flags))
{

but I always have the same error.

In order to get the m_lWindowId var I use the following code
"reinterpret_cast(GetHandle())" where GetHandle is provided by wxFrame).

Do you know what I am doing wrong?

As a workaround now I hide the SDL window when I hide the my application
window and I show it when I show my application window. However, I have
two windows in the bottom bar of my desktop. Do you have any suggestion to
avoid it?

Thanks,

Ferran