Compiler error C2664

M

mkarja

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
 
D

David Lindauer

mkarja said:
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

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

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top