BOOL CPaintApp::InitInstance() { AfxEnableControlContainer();#ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. SetRegistryKey(_T("Local AppWizard-Generated Applications")); // To create the main window, this code creates a new frame window // object and then sets it as the application's main window object. CMainFrame* pFrame = new CMainFrame; m_pMainWnd = pFrame; // create and load the frame with its resources pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // The one and only window has been initialized, so show and update it. pFrame->ShowWindow(SW_SHOW); // 设置标题 m_pMainWnd->SetWindowText("test"); // 设置标题图标 HICON hIcon = LoadIcon(IDR_MAINFRAME); m_pMainWnd->SetIcon(hIcon, FALSE); pFrame->UpdateWindow(); return TRUE; } 找到了,在init函数里面,谢谢!
SetWindowText( *m_pCWnd,(LPCTSTR)m_WindowText);// m_WindowText可以是一个CString类的变量。
{
AfxEnableControlContainer();#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif // Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
// To create the main window, this code creates a new frame window
// object and then sets it as the application's main window object. CMainFrame* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
// create and load the frame with its resources pFrame->LoadFrame(IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
NULL);
// The one and only window has been initialized, so show and update it.
pFrame->ShowWindow(SW_SHOW);
// 设置标题
m_pMainWnd->SetWindowText("test");
// 设置标题图标
HICON hIcon = LoadIcon(IDR_MAINFRAME);
m_pMainWnd->SetIcon(hIcon, FALSE);
pFrame->UpdateWindow(); return TRUE;
}
找到了,在init函数里面,谢谢!