Sign in to follow this  

Function pointer trouble

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Quote:
Original post by rogierpennink
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 ;)


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.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this