I've got a small problem. When I declare an instance of the class CWindow, its both - constructor and destructor are called.
Declaration of the class:
Fuctions of CWindow:
CWindow(char* pType, char *pCaption, int x, int y, int cx, int cy, HMENU hId, HWND hParent);
friend class CMainApp;
Use of the class:
CWindow::CWindow(char* pType, char* pCaption, int x, int y, int cx, int cy, HMENU hId, HWND hParent)
hwnd = CreateWindowEx(NULL, pType, pCaption, WS_CHILD|WS_VISIBLE, x, y, cx, cy, hParent, hId, hinstance, NULL);
hwnd = hWnd;
The debugger shows that this line is executed twice. The first execution calls the constructor, the second calls the destructor. I must be missing something very obvious here, but can't find what.
CWindow questionStatic = CWindow("static", pQuestion, 30, 10, 200, 30, NULL, hwnd);