Re: Compiler error C2664

From: David Lindauer (camille_at_bluegrass.net)
Date: 02/06/05


Date: Sun, 06 Feb 2005 22:28:21 GMT


mkarja wrote:

> Hi,
>
> I've been struggling with this error for a while and I don't
> know what's wrong. Any help would be appreciated.
> Here's code snippets and the error message.
>
> ----------------------------
> LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
> LPARAM lParam, LPARAM lParamClient, HWND _hClient);
> ----------------------------
> class WindowClass: public WNDCLASSEX
> {
> public:
> WindowClass (WNDPROC WndProc, char const * className,
> HINSTANCE hInst, const char * szChild)
> {
> ....
> )
> };
> ----------------------------
> // This is the line that gives the error
> WindowClass winClass (WndProc, className, hInst, szChild);
> ----------------------------
> error C2664: '__thiscall WindowClass::WindowClass(long (__stdcall *)
> (struct HWND__ *,unsigned int,unsigned int,long),const char *,
> struct HINSTANCE__ *,const char *)' : cannot convert parameter 1 from '
> long (struct HWND__ *,unsigned int,unsigned int,long,struct HWND__ *)'
> to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
> None of the functions with this name in scope match the target type
> ----------------------------
>
> I hope you understand my snippets. I'll try to explain more if needed.
> I'm using Visual C++ 6.0 for coding.

WndProc isn 't declared with the right number of arguments...

David



Relevant Pages

  • Something with callbacks and object instance and such...
    ... main objects WndProc I try to read or write to a protected var and it ... LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Quick question on object instantiation!
    ... I did include the object instantiation in my WndProc and made it static. ... int GetCounterconst {return iCounter;} ... WPARAM wParam, LPARAM lParam) ...
    (microsoft.public.vc.language)
  • Re: rs232 - [A]
    ... WPARAM wParam, LPARAM lParam) { ... It creates a new MySerial object every call to WndProc. ... It destroys that object when WndProc returns. ...
    (microsoft.public.vc.language)
  • Re: SHRecognizeGesture and WM_LBUTTONDOWN for edit boxes
    ... Your WndProc for the Edit - mine just calls my main WndProc, as that's where I do my processing. ... LRESULT MyEditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {if { ...
    (microsoft.public.pocketpc.developer)