J
jc
Hello,
I am trying to register my own unique window class.
The registration seems successful (the window is
displayed and there are no error messages), but when
I use FindWindow, to try and find the registered window,
the functions returns NULL
How come the window registrtation is OK, but the Findwindow
fails?
BOOL CMyApp::InitInstance()
{
WNDCLASS wndcls;
memset(&wndcls, NULL, sizeof(WNDCLASS)); // start with NULL
// Specify my own class name for using FindWindow later
wndcls.lpszClassName = _T("279CB4A9_E688_4280_9639_396697EC4FB8");
// Register the new class and exit if it fails
if(!AfxRegisterClass(&wndcls))
{
TRACE("Class Registration Failed\n");
return FALSE;
}
....
///
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
CWnd* pWnd = FindWindow(T(_"279CB4A9_E688_4280_9639_396697EC4FB8"),NULL);
//pWnd == NULL
CDocument *pDoc = GetActiveDocument();
if (pWnd != NULL) pWnd->PostMessage(WM_CLOSE);
pDoc->SetModifiedFlag(false);
CFrameWnd::OnClose();
}
TIA,
-jc
I am trying to register my own unique window class.
The registration seems successful (the window is
displayed and there are no error messages), but when
I use FindWindow, to try and find the registered window,
the functions returns NULL
How come the window registrtation is OK, but the Findwindow
fails?
BOOL CMyApp::InitInstance()
{
WNDCLASS wndcls;
memset(&wndcls, NULL, sizeof(WNDCLASS)); // start with NULL
// Specify my own class name for using FindWindow later
wndcls.lpszClassName = _T("279CB4A9_E688_4280_9639_396697EC4FB8");
// Register the new class and exit if it fails
if(!AfxRegisterClass(&wndcls))
{
TRACE("Class Registration Failed\n");
return FALSE;
}
....
///
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
CWnd* pWnd = FindWindow(T(_"279CB4A9_E688_4280_9639_396697EC4FB8"),NULL);
//pWnd == NULL
CDocument *pDoc = GetActiveDocument();
if (pWnd != NULL) pWnd->PostMessage(WM_CLOSE);
pDoc->SetModifiedFlag(false);
CFrameWnd::OnClose();
}
TIA,
-jc