Sdl & mfc

Hello,

I am looking for information on how to setup SDL to display in the client
area of an MFC app.

I am using SDL in a DLL to display images. It works fine in my win32
project, but now I need it to work in an MFC app.

I have attempted to use SDL_WINDOWID but it does not seem to work. I still
get a windowed SDL surface separate from the main app. Here is the code I
use before I init SDL and set the video.

char buff[100];
char buff2[100];
sprintf(buff,"%s",“SDL_WINDOWID=”);
sprintf(buff2,“0x%08x%”,m_pMainWnd->GetSafeHwnd());

strcat(buff,buff2);

_putenv(buff);

char* libvar = getenv( “SDL_WINDOWID” );

//Setup SDL and Initiate it
m_Irender->SetStartingAttributes(640, 480, 16,true);
m_Irender->SetWindowProperties(NULL, m_pMainWnd->GetSafeHwnd());
m_Irender->Create( NULL );

// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

Any help would be greatly appreciated.

Thank you,

Jerry Moore

Hello,

I am looking for information on how to setup SDL to display in the client
area of an MFC app.

I am using SDL in a DLL to display images. It works fine in my win32
project, but now I need it to work in an MFC app.

I have attempted to use SDL_WINDOWID but it does not seem to work. I still
get a windowed SDL surface separate from the main app. Here is the code I
use before I init SDL and set the video.

char buff[100];
char buff2[100];
sprintf(buff,"%s",“SDL_WINDOWID=”);
sprintf(buff2,“0x%08x%”,m_pMainWnd->GetSafeHwnd());

Did you mean to put the second %?
As far as I can tell you’re doing the right thing. Can you debug the SDL
library to make sure it’s seeing the environment variable?

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