Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ Win32 Error
    text
    copied!<p>I made a class for Win32 and I have no idea why this error happens.</p> <p>This is the code:</p> <p>main.cpp</p> <pre><code>using namespace std; #include "WindowManager.h" #define WIDTH 700 #define HEIGHT 500 #define VERSION 0.1 int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreviousInstance,LPSTR lpcmdline,int nCmdShow) { WindowManager window("TalkToMe", 100, 100, WIDTH, HEIGHT); while(window.isWindowOpen()) { window.PekMessage(); } return 0; } </code></pre> <p>WindowManager.h</p> <pre><code>#pragma once #include &lt;Windows.h&gt; class WindowManager { private: MSG msg; HWND window; int stat; public: WindowManager(LPCTSTR title,int x, int y, int width, int height); ~WindowManager(); LRESULT CALLBACK WindowProcedure(HWND winhan,UINT uint_Message,WPARAM parameter1,LPARAM parameter2); inline bool isWindowOpen() { return stat != -1; } int getStat() { return stat; } void PekMessage(); }; </code></pre> <p>WindowManager.cpp</p> <pre><code>#include "WindowManager.h" void WindowManager::PekMessage() { if(PeekMessage(&amp;msg, window, 0, 0, PM_REMOVE)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;msg); } } LRESULT CALLBACK WindowManager::WindowProcedure(HWND winhan,UINT uint_Message,WPARAM parameter1,LPARAM parameter2) { switch(uint_Message) { case 16: // exit button stat = -1; break; } return DefWindowProc(winhan,uint_Message,parameter1,parameter2); } WindowManager::WindowManager(LPCTSTR title,int x, int y, int width, int height) { stat = 0; WNDCLASSEX wnd; wnd.cbSize = sizeof(wnd); wnd.style = CS_HREDRAW | CS_VREDRAW; wnd.lpfnWndProc = WindowProcedure; wnd.cbClsExtra = 0; wnd.cbWndExtra = 0; wnd.hInstance = GetModuleHandle(NULL); wnd.hIcon = NULL; wnd.hCursor = LoadCursor(NULL,IDC_ARROW); wnd.hbrBackground = GetSysColorBrush(NULL); wnd.lpszClassName = "TalkToMe"; wnd.lpszMenuName = NULL; wnd.hIconSm = LoadIcon(NULL, IDI_APPLICATION); RegisterClassEx(&amp;wnd); window = CreateWindowEx(WS_EX_CONTROLPARENT, wnd.lpszClassName, title, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE, x, y, width, height,NULL, NULL, GetModuleHandle(NULL), NULL); } WindowManager::~WindowManager() { DestroyWindow(window); } </code></pre> <p>This is the weird build failure:</p> <pre><code>1&gt;------ Build started: Project: Client, Configuration: Debug Win32 ------ 1&gt; WindowManager.cpp 1&gt;c:\users\user\documents\visual studio 2012\projects\talktome\talktome\windowmanager.cpp(31): error C3867: 'WindowManager::WindowProcedure': function call missing argument list; use '&amp;WindowManager::WindowProcedure' to create a pointer to member 1&gt;c:\users\user\documents\visual studio 2012\projects\talktome\talktome\windowmanager.cpp(31): error C2440: '=' : cannot convert from 'LRESULT (__stdcall WindowManager::* )(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC' 1&gt; There is no context in which this conversion is possible 1&gt; Generating Code... 1&gt; Compiling... 1&gt; Main.cpp 1&gt; Generating Code... ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload