# Function pointer trouble

This topic is 4180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey all, I am having some trouble with a function pointer that I pass as an argument to a function. I used to have no problems with function pointers in the past, but that was when I still used Visual C++ 6, whereas I now use Visual C++ 2005. Anyway, here is the code:
virtual HWND U3DCreateWindow ( const char *winTitle, int iX, int iY, int iWidth, int iHeight, LRESULT CALLBACK (*WinProc)(HWND,UINT,WPARAM,LPARAM) = NULL ) = 0;


And these are the errors:
error C2059: syntax error : '*'
error C2091: function returns function

Apart from the brevity of these errors I'm also a bit confused about where my code would return a function since it doesn't. I hope someone can help me out with this.

##### Share on other sites
I think it should be: LRESULT (CALLBACK * WinProc)(params).

##### Share on other sites
Ah, thanks a lot raz0r - that worked indeed. Somehow I didn't find any information on this on google so you saved me from a lot of work ;)

##### Share on other sites
Quote:
 Original post by rogierpenninkAh, thanks a lot raz0r - that worked indeed. Somehow I didn't find any information on this on google so you saved me from a lot of work ;)

CALLBACK is the calling convetion, which goes in the parenthesis. I think CALLBACK became __stdcall, but I'm not too sure since I'v left win32 the first day I tried it.