Zeiger auf Proc?
-
Hallo!
Ich moechte gerne eine Funktion schreiben, die ein Fenster initialisiert. Dabei gebe ich einen Funktionszeiger auf die WinProc() mit.
Der Funktionskopf sieht also so aus:int InitWindow(HINSTANCE hInst, WindowParameters *params, LRESULT CALLBACK (*WinProc)(HWND hwnd, UINT msg, LPARAM lparam, WPARAM wparam));Ich bin noch nicht ganz so erfahren mit funktionszeigern, aber eigentlich muesste es doch so gehen oder?
Wenn ich es so mache bekomme ich folgende Fehlermeldungen:
--------------------Configuration: my_utils - Win32 Debug-------------------- Compiling... utils.cpp f:\windows\programmiertes\my_utils\my_utils.h(37) : error C2059: syntax error : '*' f:\windows\programmiertes\my_utils\my_utils.h(37) : error C2143: syntax error : missing ')' before '(' f:\windows\programmiertes\my_utils\my_utils.h(37) : error C2275: 'HWND' : illegal use of this type as an expression c:\development\vc98\include\windef.h(195) : see declaration of 'HWND' f:\windows\programmiertes\my_utils\my_utils.h(37) : error C2146: syntax error : missing ')' before identifier 'hwnd' f:\windows\programmiertes\my_utils\my_utils.h(37) : error C2072: 'InitWindow' : initialization of a function f:\windows\programmiertes\my_utils\my_utils.h(37) : error C2059: syntax error : ')' f:\windows\programmiertes\my_utils\my_utils.h(37) : error C2059: syntax error : ')' f:\windows\programmiertes\my_utils\utils.cpp(4) : error C2059: syntax error : '*' f:\windows\programmiertes\my_utils\utils.cpp(4) : error C2143: syntax error : missing ')' before '(' f:\windows\programmiertes\my_utils\utils.cpp(4) : error C2275: 'HWND' : illegal use of this type as an expression c:\development\vc98\include\windef.h(195) : see declaration of 'HWND' f:\windows\programmiertes\my_utils\utils.cpp(4) : error C2146: syntax error : missing ')' before identifier 'hwnd' f:\windows\programmiertes\my_utils\utils.cpp(4) : error C2374: 'InitWindow' : redefinition; multiple initialization f:\windows\programmiertes\my_utils\my_utils.h(37) : see declaration of 'InitWindow' f:\windows\programmiertes\my_utils\utils.cpp(4) : error C2059: syntax error : ')' f:\windows\programmiertes\my_utils\utils.cpp(4) : error C2059: syntax error : ')' f:\windows\programmiertes\my_utils\utils.cpp(5) : error C2143: syntax error : missing ';' before '{' f:\windows\programmiertes\my_utils\utils.cpp(5) : error C2447: missing function header (old-style formal list?) Error executing cl.exe. my_utils.lib - 16 error(s), 0 warning(s)Ich habe schon eine kleine vermutung, und zwar das es an dem "CALLBACK" liegt.
Kann mir bitte jemand helfen?
mfg LastManStanding
-
int InitWindow(HINSTANCE hInst, WindowParameters *params, WNDPROC wndProc);WNDPROC scheint dafür geeignet zu sein, zumindest wird das so in der WNDCLASSEX-Struktur benutzt

-
OK Danke!
Jetzt funktioniert es!mfg LastManStanding