Jump to content
  • Advertisement
Sign in to follow this  
Niddles

Problem with Windows Procedure

This topic is 4168 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright, I'm wrapping all of the Windows stuff into a nice class, to make it nice and readable, although I am having a problem with the Windows Procedure. When I initialize Windows, it isn't taking the name of the Windows Procedure I have set up. Take a look:
class KaneEngine
{
    ...
        LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
        void SetupWindows(int width, int height, int xpos, int ypos, HINSTANCE &hinst,
                          string className, string windowName);
    ...
};
    
void KaneEngine::SetupWindows(int height, int width, int xpos, int ypos, HINSTANCE &hinst,
                              string className, string windowName)
{
    WindowClass.style = 0;
    WindowClass.lpfnWndProc = WindowProcedure;
    ...
}

See the problem? I sure don't. Give any help you can! Thanks! =)

Share this post


Link to post
Share on other sites
Advertisement
Methods of a class have the calling convention __thiscall but Windows API callbacks need to be __stdcall. To solve this problem you should make your WindowProcedure() method static as well.

Take a look at this article.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!