# Problem with Windows Procedure

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

## 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 on other sites
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.