bool CTabCtrl::Register(void) { CString strClassName; WNDCLASS wcClass; // Get application object. CTask* pApp = CTask::This(); ASSERT(pApp); // Get the class name for the resource file. strClassName.LoadRsc(IDS_TABCTRL_WND); // Fill in class structure. wcClass.style = CS_HREDRAW | CS_VREDRAW; wcClass.lpfnWndProc = DefWindowProc; wcClass.cbClsExtra = 0; wcClass.cbWndExtra = 0; wcClass.hInstance = pApp->Module()->Handle(); wcClass.hIcon = NULL; wcClass.hCursor = pApp->Module()->LoadStdCursor(IDC_ARROW); wcClass.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); wcClass.lpszMenuName = NULL; wcClass.lpszClassName = strClassName; // Register. return ::RegisterClass(&wcClass); }
CFrameWnd::CFrameWnd(void) { // Get application object. CTask* pApp = CTask::This(); ASSERT(pApp); // Load strings for class name and title. m_strClassName.LoadRsc(IDS_FRAME_WND); m_strTitle.LoadRsc(IDS_APP_TITLE); // Override any WNDCLASS members. m_wcClass.hIcon = pApp->Module()->LoadIcon(ID_APP_ICON); m_wcClass.hbrBackground = (HBRUSH) (COLOR_BTNSHADOW + 1); m_wcClass.lpszClassName = m_strClassName; // Override WNDINIT members. m_wiStyle.pszClassName = m_strClassName; m_wiStyle.pszTitle = m_strTitle; m_wiStyle.dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; m_wiStyle.hParent = HWND_DESKTOP; // Check for accelerator table. if (pApp->Module()->FindResource(ID_APP_ACCEL, RT_ACCELERATOR)) { m_Accel.LoadRsc(ID_APP_ACCEL); } // Check for menu. if (pApp->Module()->FindResource(ID_APP_MENU, RT_MENU)) { m_Menu.LoadRsc(ID_APP_MENU); m_wiStyle.hMenu = m_Menu.Handle(); } else { m_wiStyle.hMenu = NULL; } // Reset members. m_pToolBar = NULL; m_pStatusBar = NULL; // m_pActiveDlg = NULL; }
void CAccel::LoadRsc(uint iID) { ASSERT(m_hAccel == NULL); // Get application object. CTask* pApp = CTask::This(); ASSERT(pApp); // Load the resource. m_hAccel = pApp->Module()->LoadAccel(iID); }
void CMenu::LoadRsc(uint iID) { ASSERT(m_hMenu == NULL); // Get application object. CTask* pApp = CTask::This(); ASSERT(pApp); // Load the resource. m_hMenu = pApp->Module()->LoadMenu(iID); }