BOOL CSceneEditorApp::InitInstance() { // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // AfxInitRichEdit2() is required to use RichEdit control // AfxInitRichEdit2(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // 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("AJN\\Disaster Simulator\\SceneEditor Application")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CSceneEditorDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CSceneEditorView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); InitEngine(); return TRUE; }
#include "BCGPDockBar.h" #include "BCGPDockingControlBar.h" #include "BCGPDockBarRow.h" #include "trackmouse.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define BCGP_DISPLAY_AHWND_EVENT 1 int CBCGPAutoHideToolBar::m_nShowAHWndDelay = 400; CRuntimeClass* CBCGPAutoHideToolBar::m_pAutoHideButtonRTS = RUNTIME_CLASS (CBCGPAutoHideButton); IMPLEMENT_DYNCREATE(CBCGPAutoHideToolBar, CBCGPControlBar) ///////////////////////////////////////////////////////////////////////////// // CBCGPAutoHideToolBar CBCGPAutoHideToolBar::CBCGPAutoHideToolBar() { m_pLastActiveButton = NULL; m_bReadyToDisplayAHWnd = FALSE; m_nDisplayAHWndTimerID = 0; m_pHighlightedButton = NULL; m_bTracked = FALSE; m_bResetSizes = FALSE; }
BOOL COSMCtrlAppApp::InitInstance() { //Initialize OLE if (!AfxOleInit()) { AfxMessageBox(IDS_OLE_INIT_FAILED, MB_OK | MB_ICONSTOP); return FALSE; } //Initialize GDI+ #ifdef COSMCTRL_NOD2D Gdiplus::GdiplusStartupInput gdiplusStartupInput; if (Gdiplus::GdiplusStartup(&m_GDIPlusToken, &gdiplusStartupInput, NULL) != Gdiplus::Ok) { AfxMessageBox(_T("Failed to initialize GDI+"), MB_OK | MB_ICONSTOP); return FALSE; } #endif INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); #ifdef _DEBUG //Just some test code to exercise the various methods which implement Vincenty's algorithms COSMCtrlPosition pos1(-77.04978, 38.88922); double dEndBearing = 0; COSMCtrlPosition pos2 = COSMCtrlHelper::GetPosition(pos1, 51.7679, 6179016.13586, &dEndBearing); double dStartBearing; double dDistance = COSMCtrlHelper::DistanceBetweenPoints(pos1, pos2, &dStartBearing, &dEndBearing); dDistance; //Do the reverse test COSMCtrlPosition pos3(2.29583, 48.85889); double dStartBearing2; double dEndBearing2; double dDistance2 = COSMCtrlHelper::DistanceBetweenPoints(pos1, pos3, &dStartBearing2, &dEndBearing2); pos1 = COSMCtrlPosition(175.04978, 38.88922); pos2 = COSMCtrlHelper::GetPosition(pos1, 90, 8000, &dEndBearing); pos1 = COSMCtrlPosition(-77.04978, 38.88922); double dEndBearing3; COSMCtrlPosition pos4 = COSMCtrlHelper::GetPosition(pos1, dStartBearing2, dDistance2, &dEndBearing3); COSMCtrlPosition pos5(-180, 0); COSMCtrlPosition pos6(0, 0); double dStartBearing5; double dEndBearing5; double dDistance5 = COSMCtrlHelper::DistanceBetweenPoints(pos5, pos6, &dStartBearing5, &dEndBearing5); dDistance5; COSMCtrlPosition pos7(0, 0); COSMCtrlPosition pos8(-180, 0); double dStartBearing7; double dEndBearing7; double dDistance7 = COSMCtrlHelper::DistanceBetweenPoints(pos7, pos8, &dStartBearing7, &dEndBearing7); dDistance7; COSMCtrlPosition pos9(0, 90); COSMCtrlPosition pos10(0, -90); double dStartBearing9; double dEndBearing9; double dDistance9 = COSMCtrlHelper::DistanceBetweenPoints(pos9, pos10, &dStartBearing9, &dEndBearing9); dDistance9; COSMCtrlPosition pos11(0, -90); COSMCtrlPosition pos12(0, 90); double dStartBearing11; double dEndBearing11; double dDistance11 = COSMCtrlHelper::DistanceBetweenPoints(pos11, pos12, &dStartBearing11, &dEndBearing11); dDistance11; COSMCtrlPosition pos13(0, 60); COSMCtrlPosition pos14(180, -60); double dStartBearing13; double dEndBearing13; double dDistance13 = COSMCtrlHelper::DistanceBetweenPoints(pos13, pos14, &dStartBearing13, &dEndBearing13); dDistance13; COSMCtrlPosition pos15(180, -60); COSMCtrlPosition pos16(0, 60); double dStartBearing15; double dEndBearing15; double dDistance15 = COSMCtrlHelper::DistanceBetweenPoints(pos15, pos16, &dStartBearing15, &dEndBearing15); dDistance15; #endif CWinApp::InitInstance(); //Standard initialization SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) //Register the application's document templates. Document templates //serve as the connection between documents, frame windows and views CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(COSMCtrlAppDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(COSMCtrlAppView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); //Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); //Dispatch commands specified on the command line. Will return FALSE if //app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!ProcessShellCommand(cmdInfo)) return FALSE; //The one and only window has been initialized, so show and update it m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; }
void CRetrConfigDlg::UpdateGrid(void) { CString str; CStringArray aOptions; CWordArray aProcesses; for(int j = 0; j < m_Main_Set.m_ProcessInfoArray.GetSize();j++) { if(m_Main_Set.m_ProcessInfoArray[j].TYPE_PROTOKOL == 2) { str.Format("№%d (MODBUS-slave)",j+1); aProcesses.Add(j+1); aOptions.Add(str); } if(m_Main_Set.m_ProcessInfoArray[j].TYPE_PROTOKOL == 4) { str.Format("№%d (IEC870-5-101-slave)",j+1); aOptions.Add(str); aProcesses.Add(j+1); } if(m_Main_Set.m_ProcessInfoArray[j].TYPE_PROTOKOL == 8) { str.Format("№%d (IEC870-5-104-slave PtP)",j+1); aOptions.Add(str); aProcesses.Add(j+1); } if(m_Main_Set.m_ProcessInfoArray[j].TYPE_PROTOKOL == 14) { str.Format("№%d (IEC870-5-104-slave PtMP)",j+1); aOptions.Add(str); aProcesses.Add(j+1); } if(m_Main_Set.m_ProcessInfoArray[j].TYPE_PROTOKOL == 18) { str.Format("№%d (Вывод на ДЩ)",j+1); aOptions.Add(str); aProcesses.Add(j+1); } } m_Grid.DeleteNonFixedRows(); for(int i = 0; i < m_Retr.m_ManyRetrArray.GetSize();i++) { int nIndex = m_Grid.InsertRow(NULL); str.Format("%d",i+1); m_Grid.SetItemText(nIndex,0,str); str.Format("%d",m_Retr.m_ManyRetrArray[i].START_ADRES_OBJECT); m_Grid.SetItemText(nIndex,1,str); str.Format("%d",m_Retr.m_ManyRetrArray[i].START_ADRES_RETR); m_Grid.SetItemText(nIndex,2,str); str.Format("%d",m_Retr.m_ManyRetrArray[i].NUM_MANY_RETR_OBJECT); m_Grid.SetItemText(nIndex,3,str); m_Grid.SetCellType(nIndex,4, RUNTIME_CLASS(CGridCellCombo)); CGridCellCombo *pCell = (CGridCellCombo*) m_Grid.GetCell(nIndex,4); pCell->SetOptions(aOptions); pCell->SetStyle(CBS_DROPDOWNLIST); //CBS_DROPDOWN, CBS_DROPDOWNLIST, CBS_SIMPLE for(int k = 0; k < aProcesses.GetSize(); k++) { if(aProcesses[k] == m_Retr.m_ManyRetrArray[i].PATH_DIRECT) { pCell->SetCurSel(k); break; } } m_Grid.SetItemText(nIndex,5,m_Retr.m_ManyRetrArray[i].strCOMMENT); } m_Grid.AutoSize(); m_Grid.Refresh(); }
CH3Doc* CH3View::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CH3Doc))); return (CH3Doc*)m_pDocument; }
BOOL CExpressSystemApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); // 创建 shell 管理器,以防对话框包含 // 任何 shell 树视图控件或 shell 列表视图控件。 CShellManager *pShellManager = new CShellManager; // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题 CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("快递系统")); DatabaseADO::initADO(); // enable ADO DatabaseADO baseAdo; DatabaseADO outAdo; if (outAdo.openBase(FileNameString) == false) { outAdo.CreateMdb(FileNameString); } CExpressSystemDlg dlg(baseAdo, outAdo); m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: 在此放置处理何时用 // “确定”来关闭对话框的代码 } else if (nResponse == IDCANCEL) { // TODO: 在此放置处理何时用 // “取消”来关闭对话框的代码 } else if (nResponse == -1) { TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n"); TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n"); } // 删除上面创建的 shell 管理器。 if (pShellManager != NULL) { delete pShellManager; } // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序, // 而不是启动应用程序的消息泵。 return FALSE; }
/***************************************************************************** Sets up a column to be drawn with + - tree controls w/ indenting. Text is automatically indented. Rows expand and collapse as appropriate 3/2001: Tree can be in fixed column, too *****************************************************************************/ BOOL CTreeColumn::TreeSetup( CGridCtrl* apGridCtrl, // tree acts on a column in this grid int aiColumn, // which column has tree int aiTotalRows, // total number of rows in the // tree if totally expanded int aiFixedRowCount,// Set fixed row count now, too // Grid total rows=aiTotalRows+aiFixedRowCount const unsigned char* apucTreeLevelAry, // Tree Level data array -- // must have aiTotalRows of entries BOOL abShowTreeLines, // T=show tree (not grid) lines; F=no tree lines BOOL abUseImages, // T=use 1st 3 images from already set image list // to display folder graphics CRuntimeClass* apRuntimeClass) // can use your special // CGridTreeCellBase-derived class // returns: success / fail { ASSERT( apGridCtrl != NULL); ASSERT( aiColumn < apGridCtrl->GetColumnCount()); m_pRuntimeClassTreeCell = apRuntimeClass; if( m_pRuntimeClassTreeCell == NULL) // default can hold data m_pRuntimeClassTreeCell = RUNTIME_CLASS(CGridTreeCell); if (!m_pRuntimeClassTreeCell->IsDerivedFrom(RUNTIME_CLASS(CGridTreeCellBase))) { ASSERT( FALSE); return FALSE; } m_pGrid = apGridCtrl; m_bAllowDraw = FALSE; // prevents crash during reset BOOL bRC = TRUE; m_iFixedRowCount = aiFixedRowCount; m_iRowCount = aiTotalRows + aiFixedRowCount; m_iColumnWithTree = aiColumn; m_pGrid->SetFixedRowCount( m_iFixedRowCount); m_pGrid->SetRowCount( m_iRowCount); if( aiTotalRows > 0) { ASSERT( apucTreeLevelAry != NULL); // retain old cell properties: establishes size for // tree drawing box based on current font CGridTreeCell GridCellCopy; GridCellCopy.SetTreeColumn( this); CGridCellBase* pCurrCell = m_pGrid->GetCell( 0, m_iColumnWithTree); if (pCurrCell) GridCellCopy = *pCurrCell; // copy all data while replacing cells to tree cell type for( int i1=0; i1 < aiTotalRows; i1++) { int iCellRow = m_iFixedRowCount + i1; if( !m_pGrid->SetCellType( iCellRow, m_iColumnWithTree, m_pRuntimeClassTreeCell ) ) { bRC = FALSE; break; } CGridTreeCell* pGridTreeCell = (CGridTreeCell*)m_pGrid->GetCell( iCellRow, m_iColumnWithTree); if( pGridTreeCell != NULL) { pGridTreeCell->SetTreeColumn( this); pGridTreeCell->SetLevelAndHide( *apucTreeLevelAry ); } apucTreeLevelAry++; } SetTreeUsesImages( abUseImages); // T=use images SetTreeLines( abShowTreeLines); // T=show tree lines } m_bAllowDraw = TRUE; m_pGrid->Invalidate(); return bRC; }
BOOL CMultiApp::InitInstance() { one a; //two b; //b.test(); // testSmartPtrs(); test_duplicate(); /*testFunctors(); test_decorator();*/ /*testLambada(); testTemplates(); testGarbageCollector(); test_tuple();*/ //int tt = 7; //int* a = &tt; //int*b = &tt; //multiThreadTest(); // stringTest(); // stackTest(); // testBFS(); // testDFS(); // binaryTreeTest(); // subProcessTest(); // multiThreadingTest(); // oddEvenTest(); producerConsumerTest(); excel_column_converter(std::string("AA")); excel_column_converter(std::string("27")); // other method for odd even printing ... doesn't work... // { //InitializeCriticalSection(&cs); //_beginthreadex(NULL, NULL, even_thread_cs, 0,0, 0); //_beginthreadex(NULL, NULL, odd_thread_cs, 0,0, 0); //getchar(); //} return TRUE; // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // AfxInitRichEdit2() is required to use RichEdit control // AfxInitRichEdit2(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // 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")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CMultiDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CMultiView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand return TRUE; }
BOOL COXCustomizeTabbedMDIPage::ApplyChanges() { if(!UpdateData(TRUE)) return FALSE; CWnd* pWnd=AfxGetMainWnd(); ASSERT(pWnd!=NULL && ::IsWindow(pWnd->GetSafeHwnd())); ASSERT_KINDOF(CMDIFrameWnd,pWnd); if(!pWnd->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd))) { TRACE(_T("COXCustomizeTabbedMDIPage::InitializeTabbedMDI: tabbed MDI is supported only for MDI applications\n")); return FALSE; } m_dwStyle=0; // orientation switch(m_treeTabCtrlSettings.GetCheckedRadioButton(IDC_RADIO_ORIENT_LEFT, IDC_RADIO_ORIENT_BOTTOM)) { case IDC_RADIO_ORIENT_LEFT: m_dwStyle|=TCS_VERTICAL; break; case IDC_RADIO_ORIENT_TOP: break; case IDC_RADIO_ORIENT_RIGHT: m_dwStyle|=TCS_VERTICAL|TCS_BOTTOM; break; case IDC_RADIO_ORIENT_BOTTOM: m_dwStyle|=TCS_BOTTOM; break; default: ASSERT(FALSE); } // appearance switch(m_treeTabCtrlSettings.GetCheckedRadioButton(IDC_RADIO_APPEARANCE_TAB_BUTTONS, IDC_RADIO_APPEARANCE_FLAT_BUTTONS)) { case IDC_RADIO_APPEARANCE_TAB_BUTTONS: break; case IDC_RADIO_APPEARANCE_PUSH_BUTTONS: m_dwStyle|=TCS_BUTTONS; break; case IDC_RADIO_APPEARANCE_FLAT_BUTTONS: m_dwStyle|=TCS_BUTTONS|TCS_FLATBUTTONS; break; default: ASSERT(FALSE); } // positioning switch(m_treeTabCtrlSettings.GetCheckedRadioButton(IDC_RADIO_POSITIONING_SINGLELINE, IDC_RADIO_POSITIONING_MULTILINE)) { case IDC_RADIO_POSITIONING_SINGLELINE: break; case IDC_RADIO_POSITIONING_MULTILINE: m_dwStyle|=TCS_MULTILINE; break; default: ASSERT(FALSE); } // display if(m_treeTabCtrlSettings.GetCheck(IDC_CHECK_DISPLAY_HOTTRACK)==OTITEM_CHECKED) m_dwStyle|=TCS_HOTTRACK; if(m_treeTabCtrlSettings.GetCheck(IDC_CHECK_DISPLAY_FIXEDWIDTH)==OTITEM_CHECKED) m_dwStyle|=TCS_FIXEDWIDTH; if(m_treeTabCtrlSettings.GetCheck(IDC_CHECK_DISPLAY_NORAGGEDRIGHT)==OTITEM_UNCHECKED) m_dwStyle|=TCS_RAGGEDRIGHT; if(m_treeTabCtrlSettings.GetCheck(IDC_CHECK_DISPLAY_SCROLLOPPOSITE)==OTITEM_CHECKED) m_dwStyle|=TCS_SCROLLOPPOSITE; if(m_treeTabCtrlSettings.GetCheck(IDC_CHECK_DISPLAY_FORCEICONLEFT)==OTITEM_CHECKED) m_dwStyle|=TCS_FORCEICONLEFT; if(m_treeTabCtrlSettings.GetCheck(IDC_CHECK_DISPLAY_FORCELABELLEFT)==OTITEM_CHECKED) m_dwStyle|=TCS_FORCELABELLEFT; // ///////////////////////////////// if ( m_MTIClientWnd.m_hWnd != NULL ) { if(m_bSupportTabbedMDI==m_MTIClientWnd.IsAttached() && m_dwOffset==m_MTIClientWnd.GetTabCtrl()->GetOffset() && m_dwStyle==(m_MTIClientWnd.GetTabCtrl()->GetStyle()&0x0fff)) { return TRUE; } if(m_MTIClientWnd.IsAttached()) { // check if it has been attached to background painter before #ifdef OX_CUSTOMIZE_BACKGROUND BOOL bPaintBackground=FALSE; COXBackgroundPainterOrganizer* pBackgroundOrganizer= m_pCustomizeManager->GetBackgroundPainterOrganizer(); ASSERT(pBackgroundOrganizer!=NULL); COXDIB dib; PaintType paintType=Tile; COLORREF clrBk=RGB(0,0,0); CWnd* pOriginWnd=NULL; if(pBackgroundOrganizer->IsAttached(&m_MTIClientWnd)) { COXBackgroundPainter* pBackgroundPainter= pBackgroundOrganizer->GetPainter(&m_MTIClientWnd); ASSERT(pBackgroundPainter!=NULL); COXDIB* pDIB=pBackgroundPainter->GetWallpaperImage(); if(pDIB!=NULL) dib=*pDIB; paintType=pBackgroundPainter->GetPaintType(); clrBk=pBackgroundPainter->GetBkColor(); pOriginWnd=pBackgroundPainter->GetOriginWnd(); pBackgroundOrganizer->Detach(&m_MTIClientWnd); bPaintBackground=TRUE; } #endif // OX_CUSTOMIZE_BACKGROUND VERIFY(m_MTIClientWnd.Detach()); #ifdef OX_CUSTOMIZE_BACKGROUND if(bPaintBackground) { //static CWnd g_MTIClientWnd; if (m_pHelpWnd) { m_pHelpWnd->DestroyWindow(); delete m_pHelpWnd; } m_pHelpWnd=new COXHelperWnd; m_pHelpWnd->Attach(((CMDIFrameWnd*)pWnd)->m_hWndMDIClient); ASSERT(pBackgroundOrganizer!=NULL); VERIFY(pBackgroundOrganizer->Attach(m_pHelpWnd,&dib, paintType,clrBk,pOriginWnd)); } #endif // OX_CUSTOMIZE_BACKGROUND } } else if(m_bSupportTabbedMDI) { // check if there is CWnd object attached to MDIClient CWnd* pMDIClientWnd=CWnd::FromHandlePermanent(((CMDIFrameWnd*)pWnd)-> m_hWndMDIClient); if(pMDIClientWnd!=NULL) { // check if it has been attached to background painter before #ifdef OX_CUSTOMIZE_BACKGROUND BOOL bPaintBackground=FALSE; COXBackgroundPainterOrganizer* pBackgroundOrganizer= m_pCustomizeManager->GetBackgroundPainterOrganizer(); ASSERT(pBackgroundOrganizer!=NULL); COXDIB dib; PaintType paintType=Tile; COLORREF clrBk=RGB(0,0,0); CWnd* pOriginWnd=NULL; if(pBackgroundOrganizer->IsAttached(pMDIClientWnd)) { COXBackgroundPainter* pBackgroundPainter= pBackgroundOrganizer->GetPainter(pMDIClientWnd); ASSERT(pBackgroundPainter!=NULL); COXDIB* pDIB=pBackgroundPainter->GetWallpaperImage(); if(pDIB!=NULL) dib=*pDIB; paintType=pBackgroundPainter->GetPaintType(); clrBk=pBackgroundPainter->GetBkColor(); pOriginWnd=pBackgroundPainter->GetOriginWnd(); pBackgroundOrganizer->Detach(pMDIClientWnd); bPaintBackground=TRUE; } #endif // OX_CUSTOMIZE_BACKGROUND pMDIClientWnd->Detach(); VERIFY(m_MTIClientWnd.Attach((CMDIFrameWnd*)pWnd,m_dwStyle)); #ifdef OX_CUSTOMIZE_BACKGROUND if(bPaintBackground) { ASSERT(pBackgroundOrganizer!=NULL); VERIFY(pBackgroundOrganizer->Attach(&m_MTIClientWnd,&dib, paintType,clrBk,pOriginWnd)); } #endif // OX_CUSTOMIZE_BACKGROUND } else { VERIFY(m_MTIClientWnd.Attach((CMDIFrameWnd*)pWnd,m_dwStyle)); } m_MTIClientWnd.GetTabCtrl()->SetOffset(m_dwOffset); } return TRUE; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { AfxGetApp()->m_nCmdShow = SW_HIDE; if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; //界面居中显示 this ->CenterWindow(CWnd::GetDesktopWindow()); if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_STRETCH, NULL); m_wndStatusBar.SetPaneInfo(1, m_wndStatusBar.GetItemID(1), SBPS_NORMAL, 180); m_wndStatusBar.SetPaneInfo(2, m_wndStatusBar.GetItemID(2), SBPS_NORMAL, 100); m_wndStatusBar.SetPaneInfo(3, m_wndStatusBar.GetItemID(3), SBPS_NORMAL, 100); m_wndStatusBar.SetPaneInfo(4, m_wndStatusBar.GetItemID(4), SBPS_NORMAL, NULL); m_wndStatusBar.SetPaneInfo(5, m_wndStatusBar.GetItemID(5), SBPS_NORMAL, NULL); m_wndStatusBar.SetPaneInfo(6, m_wndStatusBar.GetItemID(6), SBPS_NORMAL, NULL); /////////////////////////////////////////////////////////////////////////////////////// m_wndStatusBar.EnableCustomization(); if (!m_TrayIcon.Create(_T(""), // Toolktip text this, // Parent window IDR_MAINFRAME, // Icon resource ID IDR_MINIMIZE, // Resource ID of popup menu IDM_SHOW, // Default menu item for popup menu false)) // True if default menu item is located by position { TRACE0("Failed to create tray icon\n"); return -1; } if (!InitCommandBars()) { return -1; } CXTPCommandBars* pCommandBars = GetCommandBars(); CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME); pMenuBar->SetFlags(xtpFlagAddMDISysPopup); CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop); if (!pCommandBar || !pCommandBar->LoadToolBar(IDR_TOOLBAR3)) { TRACE0("Failed to create toolbar\n"); return -1; }; pCommandBars->GetCommandBarsOptions()->bShowTextBelowIcons = TRUE; pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowWindowsDefault); m_paneManager.InstallDockingPanes(this); m_paneManager.SetTheme(xtpPaneThemeWinExplorer); CXTPDockingPane* pwndPaneLog = CreatePane(300, 141, RUNTIME_CLASS(CLogView), _T("日志信息"), xtpPaneDockBottom); CXTPDockingPane* pwndPaneShortcuts = CreatePane(200, 145, RUNTIME_CLASS(CShortcuts), _T("快捷功能"), xtpPaneDockRight,pwndPaneLog); CXTPDockingPane* pwndPaneIPUP = CreatePane(200, 145, RUNTIME_CLASS(CIPUpdate), _T("域名更新"), xtpPaneDockRight,pwndPaneLog); pwndPaneIPUP->Select(); m_paneManager.AttachPane( pwndPaneIPUP ,pwndPaneShortcuts ); pwndPaneShortcuts->SetOptions(xtpPaneNoCaption); pwndPaneIPUP->SetOptions(xtpPaneNoCaption); XTPColorManager()->DisableLunaColors(TRUE); CXTPPaintManager::SetTheme(xtpThemeOffice2003); LoadCommandBars(_T("CommandBars")); SetTimer(1,1000,NULL); return 0; }
BOOL CmouseApp::InitInstance() { // アプリケーション マニフェストが visual スタイルを有効にするために、 // ComCtl32.dll Version 6 以降の使用を指定する場合は、 // Windows XP に InitCommonControlsEx() が必要です。さもなければ、ウィンドウ作成はすべて失敗します。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // アプリケーションで使用するすべてのコモン コントロール クラスを含めるには、 // これを設定します。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); // OLE ライブラリを初期化します。 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // RichEdit コントロールを使用するには AfxInitRichEdit2() が必要です // AfxInitRichEdit2(); // 標準初期化 // これらの機能を使わずに最終的な実行可能ファイルの // サイズを縮小したい場合は、以下から不要な初期化 // ルーチンを削除してください。 // 設定が格納されているレジストリ キーを変更します。 // TODO: 会社名または組織名などの適切な文字列に // この文字列を変更してください。 SetRegistryKey(_T("アプリケーション ウィザードで生成されたローカル アプリケーション")); LoadStdProfileSettings(4); // 標準の INI ファイルのオプションをロードします (MRU を含む) // アプリケーション用のドキュメント テンプレートを登録します。ドキュメント テンプレート // はドキュメント、フレーム ウィンドウとビューを結合するために機能します。 CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CmouseDoc), RUNTIME_CLASS(CMainFrame), // メイン SDI フレーム ウィンドウ RUNTIME_CLASS(CmouseView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // DDE、file open など標準のシェル コマンドのコマンド ラインを解析します。 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // コマンド ラインで指定されたディスパッチ コマンドです。アプリケーションが // /RegServer、/Register、/Unregserver または /Unregister で起動された場合、False を返します。 if (!ProcessShellCommand(cmdInfo)) return FALSE; // メイン ウィンドウが初期化されたので、表示と更新を行います。 m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; }
Cmfc_opencv_demoDoc* Cmfc_opencv_demoView::GetDocument() const // 非调试版本是内联的 { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cmfc_opencv_demoDoc))); return (Cmfc_opencv_demoDoc*)m_pDocument; }
CSoCProjectDoc* CSoCProjectView::GetDocument() const // 디버그되지 않은 버전은 인라인으로 지정됩니다. { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSoCProjectDoc))); return (CSoCProjectDoc*)m_pDocument; }
BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz) { ASSERT(bHorz == IsHorzDocked()); int nFirst, nLast, nThis; GetRowInfo(nFirst, nLast, nThis); int nLengthAvail = nLengthTotal; int nLengthActual = 0; int nLengthMin = 2; int nWidthMax = 0; CSizingControlBar* pBar; int i; for (i = nFirst; i <= nLast; i++) { pBar = (CSizingControlBar*) m_pDockBar->m_arrBars[i]; if (HIWORD(pBar) == 0) continue; // placeholder if (!pBar->IsVisible()) continue; BOOL bIsSizingBar = pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)); int nLengthBar; // minimum length of the bar if (bIsSizingBar) nLengthBar = bHorz ? pBar->m_szMinHorz.cx - 2 : pBar->m_szMinVert.cy - 2; else { CRect rcBar; pBar->GetWindowRect(&rcBar); nLengthBar = bHorz ? rcBar.Width() - 2 : rcBar.Height() - 2; } nLengthMin += nLengthBar; if (nLengthMin > nLengthTotal) { // split the row after fixed bar if (i < nThis) { m_pDockBar->m_arrBars.InsertAt(i + 1, (CControlBar*) NULL); return FALSE; } // only this sizebar remains on the row, adjust it to minsize if (i == nThis) { if (bHorz) m_szHorz.cx = m_szMinHorz.cx; else m_szVert.cy = m_szMinVert.cy; return TRUE; // the dockbar will split the row for us } // we have enough bars - go negotiate with them m_pDockBar->m_arrBars.InsertAt(i, (CControlBar*) NULL); nLast = i - 1; break; } if (bIsSizingBar) { nLengthActual += bHorz ? pBar->m_szHorz.cx - 2 : pBar->m_szVert.cy - 2; nWidthMax = max(nWidthMax, bHorz ? pBar->m_szHorz.cy : pBar->m_szVert.cx); } else nLengthAvail -= nLengthBar; } CSCBArray arrSCBars; GetRowSizingBars(arrSCBars); int nNumBars = arrSCBars.GetSize(); int nDelta = nLengthAvail - nLengthActual; // return faster when there is only one sizing bar per row (this one) if (nNumBars == 1) { ASSERT(arrSCBars[0] == this); if (nDelta == 0) return TRUE; m_bKeepSize = FALSE; (bHorz ? m_szHorz.cx : m_szVert.cy) += nDelta; return TRUE; } // make all the bars the same width for (i = 0; i < nNumBars; i++) if (bHorz) arrSCBars[i]->m_szHorz.cy = nWidthMax; else arrSCBars[i]->m_szVert.cx = nWidthMax; // distribute the difference between the bars, // but don't shrink them below their minsizes while (nDelta != 0) { int nDeltaOld = nDelta; for (i = 0; i < nNumBars; i++) { pBar = arrSCBars[i]; int nLMin = bHorz ? pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy; int nL = bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy; if ((nL == nLMin) && (nDelta < 0) || // already at min length pBar->m_bKeepSize) // or wants to keep its size continue; // sign of nDelta int nDelta2 = (nDelta == 0) ? 0 : ((nDelta < 0) ? -1 : 1); (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) += nDelta2; nDelta -= nDelta2; if (nDelta == 0) break; } // clear m_bKeepSize flags if ((nDeltaOld == nDelta) || (nDelta == 0)) for (i = 0; i < nNumBars; i++) arrSCBars[i]->m_bKeepSize = FALSE; } return TRUE; }
CMabinogiPackageToolDoc* CLeftView::GetDocument() // 非调试版本是内联的 { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMabinogiPackageToolDoc))); return (CMabinogiPackageToolDoc*)m_pDocument; }
void CMainFrame::OnAppLook(UINT id) { CDockingManager::SetDockingMode (DT_SMART); m_nAppLook = id; switch (m_nAppLook) { case ID_VIEW_APPLOOK_2000: // enable Office 2000 look: CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManager)); break; case ID_VIEW_APPLOOK_XP: // enable Office XP look: CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOfficeXP)); break; case ID_VIEW_APPLOOK_WIN_XP: // enable Windows XP look (in other OS Office XP look will be used): CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE; CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerWindows)); break; case ID_VIEW_APPLOOK_2003: // enable Office 2003 look: CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2003)); CDockingManager::SetDockingMode (DT_SMART); break; case ID_VIEW_APPLOOK_VS2005: // enable VS.NET 2005 look: CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerVS2005)); CMFCVisualManager::GetInstance (); CDockingManager::SetDockingMode (DT_SMART); break; case ID_VIEW_APPLOOK_2007_1: // enable Office 2007 look: CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_LunaBlue); CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2007)); CDockingManager::SetDockingMode (DT_SMART); break; case ID_VIEW_APPLOOK_2007_2: // enable Office 2007 look: CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_ObsidianBlack); CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2007)); CDockingManager::SetDockingMode (DT_SMART); break; case ID_VIEW_APPLOOK_2007_3: // enable Office 2007 look: CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_Aqua); CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2007)); CDockingManager::SetDockingMode (DT_SMART); break; case ID_VIEW_APPLOOK_2007_4: // enable Office 2007 look: CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_Silver); CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2007)); CDockingManager::SetDockingMode (DT_SMART); break; default: ASSERT (FALSE); } CDockingManager* pDockManager = GetDockingManager (); if (pDockManager != NULL) { ASSERT_VALID (pDockManager); pDockManager->AdjustPaneFrames (); } RecalcLayout (); RedrawWindow (NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); theApp.WriteInt (_T("ApplicationLook"), m_nAppLook); }
BOOL CSampleApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. // Starting with MFC 7 and VS.net, Enable3dControls is no longer // necessary... // #if _MFC_VER < 0x0700 #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif #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")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_SAMPLETYPE, RUNTIME_CLASS(CSampleDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CSampleView)); AddDocTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The main window has been initialized, so show and update it. pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); return TRUE; }
BOOL CBoxProxyApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // 初始化 OLE 库 if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskbarInteraction(FALSE); // 使用 RichEdit 控件需要 AfxInitRichEdit2() // AfxInitRichEdit2(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("应用程序向导生成的本地应用程序")); LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // 注册应用程序的文档模板。文档模板 // 将用作文档、框架窗口和视图之间的连接 CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CBoxProxyDoc), RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口 RUNTIME_CLASS(CBoxProxyView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 分析标准 shell 命令、DDE、打开文件操作的命令行 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // 调度在命令行中指定的命令。如果 // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。 if (!ProcessShellCommand(cmdInfo)) return FALSE; // 唯一的一个窗口已初始化,因此显示它并对其进行更新 m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; }
// COpenScrapeApp initialization BOOL COpenScrapeApp::InitInstance() { HMODULE hMod; HANDLE hProcess; DWORD curprocid, aProcesses[1024], cbNeeded, cProcesses; char sCurProcessName[MAX_PATH], sProcessName[MAX_PATH]; // Classes if (!p_tablemap) p_tablemap = new CTablemap; // Figure out our session number - get name of current process curprocid = GetCurrentProcessId(); hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, curprocid ); if (hProcess != NULL) { if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) ) { GetModuleBaseName( hProcess, hMod, sCurProcessName, MAX_PATH ); } } CloseHandle(hProcess); // Noew look through process list and count number of matching processes EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ); cProcesses = cbNeeded / sizeof(DWORD); sessionnum = 0; for (int i=0; i<(int) cProcesses; i++) { hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i] ); if (hProcess != NULL) { if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) ) { GetModuleBaseName( hProcess, hMod, sProcessName, MAX_PATH ); } } CloseHandle(hProcess); if (strcmp(sCurProcessName, sProcessName)==0) { sessionnum++; } } // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored SetRegistryKey(_T("OpenScrape")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(COpenScrapeDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(COpenScrapeView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand m_pMainWnd->DragAcceptFiles(); // Start tablemap dialog m_TableMapDlg = new CDlgTableMap(NULL); // Create a desktop-based window, no longer a dialog-based one (BillW) // http://www.maxinmontreal.com/forums/viewtopic.php?f=112&t=16464 m_TableMapDlg->Create(CDlgTableMap::IDD, CWnd::GetDesktopWindow()); m_TableMapDlg->ShowWindow(SW_SHOW); ArrangeWindows(); return true; }
CUSBLogDoc* CUSBLogView::GetDocument(void) // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CUSBLogDoc))); return (CUSBLogDoc*)m_pDocument; }
void M_SetMenu(FName menu, int param) { // some menus need some special treatment switch (menu) { case NAME_Episodemenu: // sent from the player class menu GameStartupInfo.Skill = -1; GameStartupInfo.Episode = -1; GameStartupInfo.PlayerClass = param == -1000? NULL : param == -1? "Random" : GetPrintableDisplayName(PlayerClasses[param].Type).GetChars(); break; case NAME_Skillmenu: // sent from the episode menu if ((gameinfo.flags & GI_SHAREWARE) && param > 0) { // Only Doom and Heretic have multi-episode shareware versions. M_StartMessage(GStrings("SWSTRING"), 1); return; } GameStartupInfo.Episode = param; M_StartupSkillMenu(&GameStartupInfo); // needs player class name from class menu (later) break; case NAME_StartgameConfirm: { // sent from the skill menu for a skill that needs to be confirmed GameStartupInfo.Skill = param; const char *msg = AllSkills[param].MustConfirmText; if (*msg==0) msg = GStrings("NIGHTMARE"); M_StartMessage (msg, 0, NAME_StartgameConfirmed); return; } case NAME_Startgame: // sent either from skill menu or confirmation screen. Skill gets only set if sent from skill menu // Now we can finally start the game. Ugh... GameStartupInfo.Skill = param; case NAME_StartgameConfirmed: G_DeferedInitNew (&GameStartupInfo); if (gamestate == GS_FULLCONSOLE) { gamestate = GS_HIDECONSOLE; gameaction = ga_newgame; } M_ClearMenus (); return; case NAME_Savegamemenu: if (!usergame || (players[consoleplayer].health <= 0 && !multiplayer) || gamestate != GS_LEVEL) { // cannot save outside the game. M_StartMessage (GStrings("SAVEDEAD"), 1); return; } } // End of special checks FMenuDescriptor **desc = MenuDescriptors.CheckKey(menu); if (desc != NULL) { if ((*desc)->mNetgameMessage.IsNotEmpty() && netgame && !demoplayback) { M_StartMessage((*desc)->mNetgameMessage, 1); return; } if ((*desc)->mType == MDESC_ListMenu) { FListMenuDescriptor *ld = static_cast<FListMenuDescriptor*>(*desc); if (ld->mAutoselect >= 0 && ld->mAutoselect < (int)ld->mItems.Size()) { // recursively activate the autoselected item without ever creating this menu. ld->mItems[ld->mAutoselect]->Activate(); } else { const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DListMenu) : ld->mClass; DListMenu *newmenu = (DListMenu *)cls->CreateNew(); newmenu->Init(DMenu::CurrentMenu, ld); M_ActivateMenu(newmenu); } } else if ((*desc)->mType == MDESC_OptionsMenu) { FOptionMenuDescriptor *ld = static_cast<FOptionMenuDescriptor*>(*desc); const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DOptionMenu) : ld->mClass; DOptionMenu *newmenu = (DOptionMenu *)cls->CreateNew(); newmenu->Init(DMenu::CurrentMenu, ld); M_ActivateMenu(newmenu); } return; } else { const PClass *menuclass = PClass::FindClass(menu); if (menuclass != NULL) { if (menuclass->IsDescendantOf(RUNTIME_CLASS(DMenu))) { DMenu *newmenu = (DMenu*)menuclass->CreateNew(); newmenu->mParentMenu = DMenu::CurrentMenu; M_ActivateMenu(newmenu); return; } } } Printf("Attempting to open menu of unknown type '%s'\n", menu.GetChars()); }
void CUSBLogView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* pHint) { if((NULL == pHint) || (!pHint->IsKindOf(RUNTIME_CLASS(CURB)))) { CUSBLogDoc *pDoc = GetDocument(); if(pDoc->IsTimeFormatRelative() != m_nTimeFormat) { m_nTimeFormat = pDoc->IsTimeFormatRelative(); m_cTimeFormat.SetCheck(pDoc->IsTimeFormatRelative() ? 1 : 0); m_Log.Invalidate(); } if(pDoc->m_arURB.GetSize() != m_nTotalPackets) { m_nTotalPackets = pDoc->m_arURB.GetSize(); CString sStatus; sStatus.Format("%d packets", m_nTotalPackets); m_cStatus.SetWindowText(sStatus); m_cStatus.Invalidate(); m_cHardwareID.SetWindowText(pDoc->GetHardwareID()); m_cHardwareID.Invalidate(); } if(m_bSniffing != pDoc->IsSniffing()) { m_bSniffing = pDoc->IsSniffing(); m_cPlayPause.ShowWindow(m_bSniffing ? SW_NORMAL : SW_HIDE); m_cStop.ShowWindow(m_bSniffing ? SW_NORMAL : SW_HIDE); m_cPlayPause.EnableWindow(pDoc->IsSniffing()); m_cStop.EnableWindow(pDoc->IsSniffing()); DoLayout(); } if(pDoc->IsSniffing()) { if(pDoc->IsPaused()) { m_cPlayPause.SetBitmap(m_hbmPlay); } else { m_cPlayPause.SetBitmap(m_hbmPause); } } if(0 != lHint) { int nURBCnt = pDoc->m_arURB.GetSize(); GetApp().InitializeWorkTicks(nURBCnt); for(int nURB = 0; nURB < nURBCnt; ++nURB) { CURB *pURB = pDoc->m_arURB.ElementAt(nURB); ASSERT(NULL != pURB); if(NULL != pURB) { pURB->GetExpandSize(); // this trigger allocation of all strings... CMainFrame *pMainFrame = (CMainFrame*) AfxGetMainWnd(); ASSERT(pMainFrame->IsKindOf(RUNTIME_CLASS(CMainFrame))); pMainFrame->SetPercent(MulDiv(nURB, 100, nURBCnt)); } GetApp().IncrementWorkTick(); } GetApp().DeinitializeWorkTicks(); m_Log.SetURBArray(&pDoc->m_arURB); return; } return; } CURB *pURB = (CURB *) pHint; int nURB = (int) lHint; int nIndex = m_Log.FindURB(nURB); int nState = m_Log.GetState(nIndex); if(pURB->IsExpanded() && (2 == nState)) { // no change here... return; } if(!pURB->IsExpanded() && (1 == nState)) { // no change needed... return; } if(pURB->IsExpanded()) { ASSERT(1 == nState); m_Log.ExpandItem(nIndex); return; } if(!pURB->IsExpanded()) { ASSERT(2 == nState); m_Log.CollapseItem(nIndex); return; } }
CHOpenGLDoc* CHOpenGLView::GetDocument() const // 디버그되지 않은 버전은 인라인으로 지정됩니다. { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHOpenGLDoc))); return (CHOpenGLDoc*)m_pDocument; }
void CUSBLogView::OnEditPaste(void) { if(!IsClipboardFormatAvailable(GetApp().m_uClipboardFormat)) { TRACE("OnEditPaste(): no suitable clipboard format available!\n"); return; } // we need a focused URB as well... int nFocusedURB = m_Log.FindFocusedURB(); if(-1 == nFocusedURB) { nFocusedURB = 0; } if(!AfxGetMainWnd()->OpenClipboard()) { TRACE("Error while opening clipboard!\n"); return; } // from here on, we have to close the clipboard // before exiting this function, otherwise other // applications might not get a chance to copy/paste // stuff! HANDLE hBinary = NULL; PVOID pData = NULL; try { hBinary = GetClipboardData(GetApp().m_uClipboardFormat); if(NULL == hBinary) { AfxThrowNotSupportedException(); } pData = GlobalLock(hBinary); { CMyMemFile memFile(pData); CArchive ar(&memFile, CArchive::load); DWORD dwVersion = ar.ReadCount(); if(_VERSION_DWORD_ != dwVersion) { AfxThrowNotSupportedException(); } DWORD nURBCnt = ar.ReadCount(); TRACE("Pasting %d URBs...\n", nURBCnt); CUSBLogDoc *pDoc = GetDocument(); int nInsertLocation = nFocusedURB; while(0 < nURBCnt) { CRuntimeClass *pClass = ar.ReadClass(); if(!pClass->IsDerivedFrom(RUNTIME_CLASS(CURB))) { TRACE("unknown runtime class!\n"); AfxThrowArchiveException(CArchiveException::badClass); } CURB *pURB = (CURB*) pClass->CreateObject(); ASSERT(NULL != pURB); pURB->SetChunkAllocator(&pDoc->m_arURB.m_ChunkAllocator); pURB->Serialize(ar); pDoc->m_arURB.InsertAt(nInsertLocation, pURB); nInsertLocation++; --nURBCnt; } pDoc->UpdateAllViews(NULL, 1); OnEditSelectNone(); m_Log.SetFocusedURB(nFocusedURB); } GlobalUnlock(hBinary); hBinary = NULL; CloseClipboard(); } catch(...) { if((NULL != pData) && (NULL != hBinary)) { GlobalUnlock(hBinary); } CloseClipboard(); throw; } }
BOOL CRemoteDesktopApp::InitInstance() { // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); ::OleInitialize(NULL); ::AfxEnableControlContainer(); // Create the shell manager, in case the dialog contains // any shell tree view or shell list view controls. CShellManager *pShellManager = new CShellManager; // Activate "Windows Native" visual manager for enabling themes in MFC controls CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // 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")); CRemoteDesktopDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } else if (nResponse == -1) { TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n"); TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n"); } // Delete the shell manager created above. if (pShellManager != NULL) { delete pShellManager; } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
/** @brief MOUSE MOVE @author KHS @return **/ void CCableRouteAssignTOLoadDlg::OnMouseMove(UINT nFlags, CPoint point) { if (m_bDragging) { //// Move the drag image CPoint pt(point); //get our current mouse coordinates ClientToScreen(&pt); //convert to screen coordinates m_pDragImage->DragMove(pt); //move the drag image to those coordinates // Unlock window updates (this allows the dragging image to be shown smoothly) m_pDragImage->DragShowNolock(false); //// Get the CWnd pointer of the window that is under the mouse cursor CWnd* pDropWnd = WindowFromPoint (pt); ASSERT(pDropWnd); //make sure we have a window //// If we drag outside current window we need to adjust the highlights displayed if (pDropWnd != m_pDropList) { if (m_nDropIndex != -1) //If we drag over the CListCtrl header, turn off the hover highlight { TRACE("m_nDropIndex is -1\n"); CMFCListCtrl* pList = (CMFCListCtrl*)m_pDropList; //VERIFY (pList->SetItemState (m_nDropIndex, 0, LVIS_DROPHILITED)); // redraw item //VERIFY (pList->RedrawItems (m_nDropIndex, m_nDropIndex)); //pList->UpdateWindow (); m_nDropIndex = -1; } else //If we drag out of the CListCtrl altogether { TRACE("m_nDropIndex is not -1\n"); //CListCtrl* pList = (CListCtrl*)m_pDropList; //int i = 0; //int nCount = pList->GetItemCount(); //for(i = 0; i < nCount; i++) //{ // pList->SetItemState(i, 0, LVIS_DROPHILITED); //} //pList->RedrawItems(0, nCount); //pList->UpdateWindow(); } } // Save current window pointer as the CListCtrl we are dropping onto m_pDropList = (CMFCTextColorListCtrl*)pDropWnd; if(m_pDropList != m_pDragList) { // Convert from screen coordinates to drop target client coordinates pDropWnd->ScreenToClient(&pt); //If we are hovering over a CListCtrl we need to adjust the highlights if(pDropWnd->IsKindOf(RUNTIME_CLASS(CMFCListCtrl)) && (pDropWnd->GetSafeHwnd() == m_wndAssignLoadListCtrl.GetSafeHwnd())) { TRACE("m_nDropIndex is not 100\n"); //Note that we can drop here SetCursor(LoadCursor(NULL, IDC_ARROW)); CListCtrl* pList = (CListCtrl*)pDropWnd; } else if(pDropWnd->IsKindOf(RUNTIME_CLASS(CMFCListCtrl)) && (pDropWnd->GetSafeHwnd() == m_wndRouteGrListCtrl.GetSafeHwnd())) { TRACE("m_nDropIndex is not 100\n"); //Note that we can drop here SetCursor(LoadCursor(NULL, IDC_ARROW)); UINT uFlags; CListCtrl* pList = (CListCtrl*)pDropWnd; // Turn off hilight for previous drop target pList->SetItemState (m_nDropIndex, 0, LVIS_DROPHILITED); // Redraw previous item pList->RedrawItems (m_nDropIndex, m_nDropIndex); // Get the item that is below cursor m_nDropIndex = ((CListCtrl*)pDropWnd)->HitTest(pt, &uFlags); if(-1 != m_nDropIndex) { // Highlight it pList->SetItemState(m_nDropIndex, LVIS_DROPHILITED, LVIS_DROPHILITED); // Redraw item pList->RedrawItems(m_nDropIndex, m_nDropIndex); pList->UpdateWindow(); }else SetCursor(LoadCursor(NULL, IDC_NO)); } else if(pDropWnd->IsKindOf(RUNTIME_CLASS(CMFCListCtrl)) && (pDropWnd->GetSafeHwnd() == m_wndNotAssignLoadListCtrl.GetSafeHwnd())) { TRACE("m_nDropIndex is not 100\n"); //Note that we can drop here SetCursor(LoadCursor(NULL, IDC_ARROW)); CListCtrl* pList = (CListCtrl*)pDropWnd; } } else { //If we are not hovering over a CListCtrl, change the cursor // to note that we cannot drop here SetCursor(LoadCursor(NULL, IDC_NO)); } // Lock window updates m_pDragImage->DragShowNolock(true); } CDialog::OnMouseMove(nFlags, point); }
void CMainFrame::OnApplicationLook(UINT id) { CWaitCursor wait; theApp.m_nAppLook = id; switch (theApp.m_nAppLook) { case ID_VIEW_APPLOOK_WIN_2000: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager)); break; case ID_VIEW_APPLOOK_OFF_XP: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP)); break; case ID_VIEW_APPLOOK_WIN_XP: CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE; CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); break; case ID_VIEW_APPLOOK_OFF_2003: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003)); CDockingManager::SetDockingMode(DT_SMART); break; case ID_VIEW_APPLOOK_VS_2005: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005)); CDockingManager::SetDockingMode(DT_SMART); break; case ID_VIEW_APPLOOK_VS_2008: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008)); CDockingManager::SetDockingMode(DT_SMART); break; case ID_VIEW_APPLOOK_WINDOWS_7: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7)); CDockingManager::SetDockingMode(DT_SMART); break; default: switch (theApp.m_nAppLook) { case ID_VIEW_APPLOOK_OFF_2007_BLUE: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); break; case ID_VIEW_APPLOOK_OFF_2007_BLACK: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack); break; case ID_VIEW_APPLOOK_OFF_2007_SILVER: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); break; case ID_VIEW_APPLOOK_OFF_2007_AQUA: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua); break; } CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); CDockingManager::SetDockingMode(DT_SMART); } RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE); theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook); }
CTinyCADDoc* CTinyCADView::GetDocument() const // 非调试版本是内联的 { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTinyCADDoc))); return (CTinyCADDoc*)m_pDocument; }
BOOL CContentStudioApp::InitInstance() { // Initialize GDI+ for textures viewer Gdiplus::GdiplusStartupInput gdiplusStartupInput; if (Gdiplus::GdiplusStartup( &m_gdiplusToken, &gdiplusStartupInput, NULL ) != Gdiplus::Ok ) { DEBUG_PRINT("Failed to initialize GdiPlus"); return FALSE; } else { DEBUG_PRINT("GdiPlus initialized with token '%d'", m_gdiplusToken); } m_comInitialized = SUCCEEDED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)); // apartment threaded because of other UI objects that need it. if (m_comInitialized) { DEBUG_PRINT("COM initialized"); } else { DEBUG_PRINT("Failed to initialize COM"); } INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); EnableTaskbarInteraction(FALSE); // AfxInitRichEdit2() is required to use RichEdit control // AfxInitRichEdit2(); SetRegistryKey(_T("GDK")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CContentStudioDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CContentStudioView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand return TRUE; }
bool CSizableReBar::DoAddBar( CWnd* pBar, REBARBANDINFO* prbbi, LPCTSTR lpszTitle, bool bAlwaysVisible, bool bHasGripper, int nStartingWidth ) { UINT nID = ( UINT )pBar->GetDlgCtrlID(); ASSERT( nID != 0 ); ASSERT( m_rbCtrl.IDToIndex( nID ) == -1 ); // ID must be unique! // Save bar info for context menu BARINFO barinfo; barinfo.nID = nID; barinfo.bAlwaysVisible = bAlwaysVisible; barinfo.bHasGripper = bHasGripper; _tcsncpy( barinfo.szTitle, lpszTitle ? lpszTitle : _T(""), MAX_PATH ); m_aBars.Add( barinfo ); prbbi->cbSize = sizeof( *prbbi ); prbbi->fMask |= RBBIM_ID | RBBIM_BACKGROUND | RBBIM_CHILD | RBBIM_CHILDSIZE; prbbi->wID = nID; prbbi->hbmBack = m_hbmBack; prbbi->hwndChild = pBar->m_hWnd; BOOL bHorz = ( m_dwStyle & CBRS_ORIENT_HORZ ) != 0; CControlBar* pTemp = DYNAMIC_DOWNCAST( CControlBar, pBar ); if ( pTemp != 0 ) { CSize szBar = pTemp->CalcFixedLayout( FALSE, bHorz ); prbbi->cxMinChild = bHorz ? szBar.cx : szBar.cy; prbbi->cyMinChild = bHorz ? szBar.cy : szBar.cx; } else { CRect rcWindow; pBar->GetWindowRect( rcWindow ); prbbi->cxMinChild = bHorz ? rcWindow.Width() : rcWindow.Height(); prbbi->cyMinChild = bHorz ? rcWindow.Height() : rcWindow.Width(); } if ( m_bLocked || !bHasGripper ) { prbbi->fStyle &= ~RBBS_GRIPPERALWAYS; prbbi->fStyle |= RBBS_NOGRIPPER; } else { prbbi->fStyle |= RBBS_GRIPPERALWAYS; prbbi->fStyle &= ~RBBS_NOGRIPPER; } if ( pBar->IsKindOf( RUNTIME_CLASS( CMenuBar ) ) || pBar->IsKindOf( RUNTIME_CLASS( CToolBarEx ) ) ) { prbbi->fStyle |= RBBS_USECHEVRON; } if ( nStartingWidth > 0 ) { prbbi->fMask |= RBBIM_SIZE | RBBIM_CHILD | RBBIM_CHILDSIZE; prbbi->cx = nStartingWidth; prbbi->cxMinChild = nStartingWidth; } if ( !m_rbCtrl.InsertBand( ( UINT )-1, prbbi ) ) { return false; } pBar->SetOwner( this ); GetParentFrame()->RecalcLayout(); return true; }