Wednesday, December 9, 2020

Error C2440 '=': cannot convert from 'long (__cdecl *)(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC' Message

I tested a demo from Horton's book. it is written in 1997. some Win32 function prototype definition changed already for now. so it is necessary to see such errors. did research on google and collected these notes here.

Error C2440 '=': cannot convert from 'long (__cdecl *)(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'
Message c:\workmessage\main.cpp 18

in 1997 version
long WINAPI WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

current version as of 2020
LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

recompiled the project and it works.

  1. Error in windows api program: cannot convert from 'LRESULT (__stdcall *)(HWND,UINT,LPARAM,WPARAM) to WNDPROC
  2. C2440 Can't convert LRESULT to WNDPROC in C++ WinApi
  3. The new scratch program
  4. C2440 Can't convert LRESULT to WNDPROC in C WinApi
  5. Win32 Complier error

No comments:

Post a Comment