comparison src/video/windx5/SDL_dx5events.c @ 1303:52b5afd7ecee

Date: Tue, 05 Jul 2005 21:43:26 +1000 From: Sean Childs Subject: [SDL] Compiling SDL 1.2.8 with the free Borland compiler When compiling SDL 1.2.8 with the free Borland compiler, I received this error (there is a similar error that occurs in src\video\windx5\sdl_dx5events.c): Error E2342 ..\..\src\video\windib\sdl_dibevents.c 189: Type mismatch in parameter 'lpPrevWndFunc' (wanted 'int (__stdcall *)()', got 'long (__stdcall *)(void *,unsigned int,unsigned int,long)') in function DIB_HandleMessage I checked the MSDN library at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/ windowsuserinterface/windowing/windowprocedures/windowprocedurereference/wind owprocedurefunctions/callwindowproc.asp and it had this to say: If STRICT is not defined, the lpPrevWndFunc parameter has the data type FARPROC. The FARPROC type is declared as follows: int (FAR WINAPI * FARPROC) () In C, the FARPROC declaration indicates a callback function that has an unspecified parameter list. In C++, however, the empty parameter list in the declaration indicates that a function has no parameters. This subtle distinction can break careless code. Following is one way to handle this situation: #ifdef STRICT WNDPROC MyWindowProcedure #else FARPROC MyWindowProcedure #endif ... lResult = CallWindowProc(MyWindowProcedure, ...)
author Sam Lantinga <slouken@libsdl.org>
date Tue, 31 Jan 2006 15:30:42 +0000
parents ea3888b472bf
children c9b51268668f
comparison
equal deleted inserted replaced
1302:94643e9bad18 1303:52b5afd7ecee
64 static SDLKey DIK_keymap[256]; 64 static SDLKey DIK_keymap[256];
65 static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed); 65 static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed);
66 66
67 /* DJM: If the user setup the window for us, we want to save his window proc, 67 /* DJM: If the user setup the window for us, we want to save his window proc,
68 and give him a chance to handle some messages. */ 68 and give him a chance to handle some messages. */
69 static WNDPROC userWindowProc = NULL; 69 #ifdef STRICT
70 #define WNDPROCTYPE WNDPROC
71 #else
72 #define WNDPROCTYPE FARPROC
73 #endif
74 static WNDPROCTYPE userWindowProc = NULL;
70 75
71 static HWND GetTopLevelParent(HWND hWnd) 76 static HWND GetTopLevelParent(HWND hWnd)
72 { 77 {
73 HWND hParentWnd; 78 HWND hParentWnd;
74 while (1) 79 while (1)
869 } 874 }
870 875
871 /* DJM: we want all event's for the user specified 876 /* DJM: we want all event's for the user specified
872 window to be handled by SDL. 877 window to be handled by SDL.
873 */ 878 */
874 userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); 879 userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC);
875 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); 880 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage);
876 } else { 881 } else {
877 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, 882 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
878 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), 883 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
879 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); 884 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL);