I have this function pointer as a protected member of a class. Since the class in question is for a window, it needs to have a callback function. I'm sure we'd all love to have callback fuctions as methods... But it just doesn't work that way. So what I'm doing here is having a function pointer as a protected member variable so I can switch it up to point to a different function when I subclass the window.
How I originally declared the pointer was like this...
LRESULT (*_callPtr) (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
which of course didn't work when i got around to assigning it because... the class member is a __cdecl and the global function is a __stdcall
so... i said... ok duh... I'll do this.
LRESULT (__stdcall *_callPtr) (HWND g_hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Which of course works like a charm. But, I'm wondering wheather there is some hidden disadvantage to this I'm not seeing. Or if there is something horribly wrong which has gone right over my head.
Anything?
EDIT:::
To clarify... is there anything wrong with decalring it in the class as a __stdcall rather than a __cdecl
How I originally declared the pointer was like this...
LRESULT (*_callPtr) (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
which of course didn't work when i got around to assigning it because... the class member is a __cdecl and the global function is a __stdcall
so... i said... ok duh... I'll do this.
LRESULT (__stdcall *_callPtr) (HWND g_hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Which of course works like a charm. But, I'm wondering wheather there is some hidden disadvantage to this I'm not seeing. Or if there is something horribly wrong which has gone right over my head.
Anything?
EDIT:::
To clarify... is there anything wrong with decalring it in the class as a __stdcall rather than a __cdecl