Setting the Title in an SDI Application
-
I want to set the title in the Main frame window in an SDI app, but I can't seem to find the right function. I have tried setting the title in the document class, but instead of getting "Title" I get "Title -- Application Name" I have also tried CFrameWnd.SetTitle, and CFrameWnd.SetWindowText, but none of them seem to work. Any help would be much appreciated.
-
I want to set the title in the Main frame window in an SDI app, but I can't seem to find the right function. I have tried setting the title in the document class, but instead of getting "Title" I get "Title -- Application Name" I have also tried CFrameWnd.SetTitle, and CFrameWnd.SetWindowText, but none of them seem to work. Any help would be much appreciated.
Add cs.style = WS_OVERLAPPEDWINDOW;" to function CMainFrame::PreCreateWindow, and add SetWindowText("mytitle"); to function CMainFrame::OnCreate. Then the title is changed to "mytitle". BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style = WS_OVERLAPPEDWINDOW; return TRUE; } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { //... SetWindowText("mytitle"); return 0; }
-
I want to set the title in the Main frame window in an SDI app, but I can't seem to find the right function. I have tried setting the title in the document class, but instead of getting "Title" I get "Title -- Application Name" I have also tried CFrameWnd.SetTitle, and CFrameWnd.SetWindowText, but none of them seem to work. Any help would be much appreciated.
Do simply like this: In the
InitInstance()
function in your Application class, just before the linem_pMainWnd->ShowWindow(SW_SHOW)
, add the following line of code:m_pMainWnd->SetWindowText("My Application Title");
Regards, Ashok Dhamija _____________________________ Padam Technologies