1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

New Window class - cannot convert LRESULT Class:: to LRESULT

Discussion in 'Win32' started by c0d3m0nk3y, Aug 28, 2010.

  1. c0d3m0nk3y

    c0d3m0nk3y New Member

    Aug 28, 2010
    Likes Received:
    Trophy Points:
    I have two methods in my main.cpp file that deal with creating a new window.

    Firstly HWND NewWindow(...) which creates a WNDCLASSEX struct, defines some settings & registers the window.
    One of the settings is
    wndStructure.lpfnWndProc = WindowProcedure;
    WindowProcedure in this case is the second method LRESULT CALLBACK WindowProcedure(...), this defines the events that will happen based on the Messages (I think?).
    I wanted to move all of this code out of my main.cpp file into it's own class. The problem rises on the aforementioned line of code.
    The method is now declared as HWND ClassName::NewWindow(...) and the error I receive is:

    error C2440: 'type cast' : cannot convert from 'LRESULT (__stdcall ClassName::* )(HWND,UINT,WPARAM,LPARAM)' to 'LRESULT'
    I am assuming that it is not recognising the return type as LRESULT because it is ClassName::LRESULT.

    How can I get around this problem?

Share This Page