src/video/windib/SDL_dibevents.c
changeset 1280 f61f045343d3
parent 1264 f3a3f1890b91
child 1282 217f5d5a49e5
     1.1 --- a/src/video/windib/SDL_dibevents.c	Sat Jan 28 05:47:11 2006 +0000
     1.2 +++ b/src/video/windib/SDL_dibevents.c	Sun Jan 29 06:11:38 2006 +0000
     1.3 @@ -404,24 +404,23 @@
     1.4  
     1.5  int DIB_CreateWindow(_THIS)
     1.6  {
     1.7 -#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
     1.8 -	wchar_t *SDL_windowid_t;
     1.9 -#endif
    1.10 +	char *windowid = getenv("SDL_WINDOWID");
    1.11  
    1.12  #ifndef CS_BYTEALIGNCLIENT
    1.13  #define CS_BYTEALIGNCLIENT	0
    1.14  #endif
    1.15  	SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0);
    1.16 +
    1.17 +	SDL_windowid = (windowid != NULL);
    1.18  	if ( SDL_windowid ) {
    1.19 -
    1.20 -// wince 2.1 does not have strtol
    1.21  #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
    1.22 -		SDL_windowid_t = malloc((strlen(SDL_windowid) + 1) * sizeof(wchar_t));
    1.23 -		MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, SDL_windowid, -1, SDL_windowid_t, strlen(SDL_windowid) + 1);
    1.24 -		SDL_Window = (HWND)wcstol(SDL_windowid_t, NULL, 0);
    1.25 -		free(SDL_windowid_t);
    1.26 +		/* wince 2.1 does not have strtol */
    1.27 +		wchar_t *windowid_t = malloc((strlen(windowid) + 1) * sizeof(wchar_t));
    1.28 +		MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, windowid, -1, windowid_t, strlen(windowid) + 1);
    1.29 +		SDL_Window = (HWND)wcstol(windowid_t, NULL, 0);
    1.30 +		free(windowid_t);
    1.31  #else
    1.32 -		SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
    1.33 +		SDL_Window = (HWND)strtol(windowid, NULL, 0);
    1.34  #endif
    1.35  		if ( SDL_Window == NULL ) {
    1.36  			SDL_SetError("Couldn't get user specified window");