1 // OCC_BaseApp.cpp: implementation of the OCC_BaseApp class.
3 //////////////////////////////////////////////////////////////////////
7 #include "OCC_BaseApp.h"
9 #include <res\OCC_Resource.h>
11 #include <Standard_Version.hxx>
14 /////////////////////////////////////////////////////////////////////////////
17 BEGIN_MESSAGE_MAP(OCC_BaseApp, CWinApp)
18 //{{AFX_MSG_MAP(OCC_BaseApp)
19 ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
20 // NOTE - the ClassWizard will add and remove mapping macros here.
21 // DO NOT EDIT what you see in these blocks of generated code!
23 // Standard file based document commands
24 ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
25 ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
28 /////////////////////////////////////////////////////////////////////////////
29 // OCC_BaseApp construction
31 OCC_BaseApp::OCC_BaseApp()
33 OSD::SetSignal(Standard_True);
39 void OCC_BaseApp::SetSamplePath(LPCTSTR aPath)
41 char AbsoluteExecutableFileName[MAX_PATH+1];
42 HMODULE hModule = GetModuleHandle(NULL);
43 GetModuleFileName(hModule, AbsoluteExecutableFileName, MAX_PATH);
45 SamplePath = CString(AbsoluteExecutableFileName);
46 int index = SamplePath.ReverseFind('\\');
47 SamplePath.Delete(index+1, SamplePath.GetLength() - index - 1);
51 CString aCInitialDir(aPath);
52 SamplePath += "..\\" + aCInitialDir;
55 /////////////////////////////////////////////////////////////////////////////
56 // CAboutDlgStd dialog used for App About
58 class CAboutDlgStd : public CDialog
65 //{{AFX_DATA(CAboutDlgStd)
66 enum { IDD = IDD_OCC_ABOUTBOX };
69 // ClassWizard generated virtual function overrides
70 //{{AFX_VIRTUAL(CAboutDlgStd)
72 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
78 //{{AFX_MSG(CAboutDlgStd)
79 // No message handlers
84 CAboutDlgStd::CAboutDlgStd() : CDialog(CAboutDlgStd::IDD)
86 //{{AFX_DATA_INIT(CAboutDlgStd)
90 void CAboutDlgStd::DoDataExchange(CDataExchange* pDX)
92 CDialog::DoDataExchange(pDX);
93 //{{AFX_DATA_MAP(CAboutDlgStd)
97 BEGIN_MESSAGE_MAP(CAboutDlgStd, CDialog)
98 //{{AFX_MSG_MAP(CAboutDlgStd)
99 // No message handlers
103 BOOL CAboutDlgStd::OnInitDialog(){
104 CWnd* Title = GetDlgItem(IDC_ABOUTBOX_TITLE);
106 CString About = "About ";
107 CString Sample = "Sample ";
108 CString SampleName = ((OCC_BaseApp*)AfxGetApp())->GetSampleName();
109 CString Cascade = ", Open CASCADE Technology ";
110 CString Version = OCC_VERSION_STRING;
112 CString strTitle = Sample + SampleName + Cascade + Version;
113 CString dlgTitle = About + SampleName;
115 Title->SetWindowText(strTitle);
116 SetWindowText(dlgTitle);
123 // App command to run the dialog
124 void OCC_BaseApp::OnAppAbout()
126 CAboutDlgStd aboutDlg;
130 LPCTSTR OCC_BaseApp::GetSampleName()
135 LPCTSTR OCC_BaseApp::GetInitDataDir()
137 return (LPCTSTR) SamplePath;
140 void OCC_BaseApp::SetSampleName(LPCTSTR Name)