Skip to main content
gamedev.net
🔒 Locked

Writing win32 wrapper

Started by Toolmaker May 13, 2003 at 5:06 AM 0 replies 300+ views
Original Post
Toolmaker
Toolmaker
I am writing a Win32 wrapper class. For the creation of the window I am writing a static member function of the class. Like this:
  
class CWindow
{
public:
    CWindow();
    ~CWindow();
    static  LRESULT StaticWndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
    virtual LRESULT WndProc(UINT Message, WPARAM wParam, LPARAM lParam);
    virtual bool    Create(HINSTANCE hInstanceApp, HICON hIcon, HCURSOR hCursor, const char *szClassname,
                           const char *szCaption, int iX, int iY, int iWidth, int iHeight);

    HWND            GetHwnd();
private:
    HINSTANCE m_hInstance;
    HWND      m_hWnd;
};
  
However, the compiler isn''t agreeing with this approach. I am at college, not having the ability to access a normal compiler(MSVC++ 6) so I am stuck with Borland C++ 5.02. This is the error code:
Error:  cwindow.cpp(69,29):Cannot convert ''long (*)(HWND__ *,unsigned int,unsigned int,long)'' to ''long (__stdcall *)(HWND__ *,unsigned int,unsigned int,long)''
 
The errorcode occurs on the WndClass.lpfnWndProc = StaticWndProc; Any ideas? This is simple, but I do not understand. So, if you can explain why this is including the correct answer, I would be happy. Toolmaker
-Earth is 98% full. Please delete anybody you can.
 
tr0n
tr0n
Your WndProc needs to be declared as CALLBACK.

static LRESULT CALLBACK StaticWndProc(HWND hWnd,......);

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.