c++ - cannot convert from 'LRESULT (__stdcall *)(HWND,const wchar_t,WPARAM,LPARAM)' to 'WNDPROC' -


error:

i running through this tutorial on window creation, , have come across error:

error 1 error c2440: '=' : cannot convert 'lresult (__stdcall *)(hwnd,const wchar_t,wparam,lparam)' 'wndproc' 

question:

what going wrong here? tutorial outdated or of sort?

code:

the code identical or identical of tutorial.

#include "windows.h" #include "windowsx.h"  lresult callback windowproc(hwnd hwnd,                             const wchar_t message,                             wparam wparam,                             lparam lparam);  int winapi winmain(hinstance hinstance,                    hinstance hprevinstance,                    lpstr lpcmdline,                    int ncmdshow) {     //handle window, filled function     hwnd hwnd;      //this struct holds information window class     wndclassex wc;      //clear out window class      zeromemory(&wc, sizeof(wndclassex));      //fill struct needed information     wc.cbsize = sizeof(wndclassex);     wc.style = cs_hredraw | cs_vredraw;     wc.lpfnwndproc = windowproc;     wc.hinstance = hinstance;     wc.hcursor = loadcursor(null, idc_arrow);     wc.hbrbackground = (hbrush)color_window;     wc.lpszclassname = "window class";      //register window class     registerclassex(&wc);      //create window use handle     hwnd = createwindowex(  null,                             "window class",                             "our first window",                             ws_overlappedwindow,                             300,                             300,                             500,                             400,                             null,                             null,                             hinstance,                             null);      showwindow( hwnd,                 ncmdshow);      msg msg;      while(getmessage(&msg, null, 0, 0))     {         translatemessage(&msg);         dispatchmessage(&msg);     }      return msg.wparam; }  //main message handler static lresult callback windowproc(hwnd hwnd,                             const wchar_t message,                             wparam wparam,                             lparam lparam) {     //find code run message     switch(message)     {     case wm_destroy:         {             //close app entirely             postquitmessage(0);             return 0;         } break;     }      //handle messages switch didn't     return defwindowproc (hwnd, message, wparam, lparam); } 

the declarations const wchar_t message should replaced uint. error received because of faulty parameters.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -