Changing the title in SDI app
-
How can I change the title of a sdi application? I used CDocument->SetTitle() - doesn't work (nothing changes) used CMainFrame->SetWindowText - but this crashes my app (Unhandled exception - memory violation - as It got a NULL pointer, when i debugged, inside the MFC function SetWindowText, there was an ASSERT(::IsWindow(m_hWnd)), but this(==m_hWnd) was equal to NULL, so that is why there was memory violation ... used m_pszAppName (changed it) and nothing changes ... heard about taking care of OnUpdateFrameTitle, but this method is not a member of frame, or document, but an ole class ... used many other strange ways, and did not succeed ...:mad: Anyone having an idea ?PLZ:rolleyes:
-
How can I change the title of a sdi application? I used CDocument->SetTitle() - doesn't work (nothing changes) used CMainFrame->SetWindowText - but this crashes my app (Unhandled exception - memory violation - as It got a NULL pointer, when i debugged, inside the MFC function SetWindowText, there was an ASSERT(::IsWindow(m_hWnd)), but this(==m_hWnd) was equal to NULL, so that is why there was memory violation ... used m_pszAppName (changed it) and nothing changes ... heard about taking care of OnUpdateFrameTitle, but this method is not a member of frame, or document, but an ole class ... used many other strange ways, and did not succeed ...:mad: Anyone having an idea ?PLZ:rolleyes:
Where abouts in your code were you changing the window title via the CMainFrame::SetWindowText. It sounds like you were trying to do it before the window was created. Michael :-)
-
Where abouts in your code were you changing the window title via the CMainFrame::SetWindowText. It sounds like you were trying to do it before the window was created. Michael :-)
Inside the CDocument constructor, I wanted to change the title bar, when the document changes in some way... and I call a function (which calls CMainFrame::SetWindowText() ) from CDocument's constructor, and if this constructor is called when the frame doesn't exist, that is the answer... hey, thank you, I hope that is the case :)