I am getting waring "Warning: Window creation failed: GetLastError returns 0x00000579" when using below code
CWnd* m_pWndStatic = new CWnd;
m_pWndStatic->CreateEx(0, _T("STATIC"),
_T("Hi"), WS_CHILD | WS_VISIBLE | WS_POPUP,
CRect(0, 0, 20, 20), this, 1234);
It works fine if i call it without PopUp i.e. WS_POPUP. I am using VS2010.
//
// MessageId: ERROR_INVALID_MENU_HANDLE
//
// MessageText:
//
// Invalid menu handle.
//
#define ERROR_INVALID_MENU_HANDLE 1401L
Which puts you on the wrong track, the real problem is that you can't create a child window that's also a popup window. Only top level windows can be popups. The diagnostic is generated because for a popup window, it interprets the "1234" argument you pass as a menu handle instead of a child window ID.
Remove the WS_POPUP style flag.
User contributions licensed under CC BY-SA 3.0