0024943: Port MFC samples to UNICODE for compatibility with VS2013
[occt.git] / samples / mfc / standard / 03_Viewer2d / src / Viewer2dApp.cpp
1 // Viewer2dApp.cpp : Defines the class behaviors for the application.
2 //
3
4 #include "stdafx.h"
5
6 #include "Viewer2dApp.h"
7
8 #include "OCC_MainFrame.h"
9 #include "OCC_2dChildFrame.h"
10 #include "Viewer2dDoc.h"
11 #include "OCC_2dView.h"
12
13 #ifdef _DEBUG
14 #define new DEBUG_NEW
15 #undef THIS_FILE
16 static char THIS_FILE[] = __FILE__;
17 #endif
18
19 /////////////////////////////////////////////////////////////////////////////
20 // CViewer2dApp construction
21
22 CViewer2dApp::CViewer2dApp() : OCC_App()
23 {
24   SampleName = "Viewer2d"; //for about dialog
25   SetSamplePath (L"..\\..\\03_Viewer2d");
26 }
27
28 /////////////////////////////////////////////////////////////////////////////
29 // The one and only CViewer2dApp object
30
31 CViewer2dApp theApp;
32
33 /////////////////////////////////////////////////////////////////////////////
34 // CViewer2dApp initialization
35
36 BOOL CViewer2dApp::InitInstance()
37 {
38         // Standard initialization
39         // If you are not using these features and wish to reduce the size
40         //  of your final executable, you should remove from the following
41         //  the specific initialization routines you do not need.
42
43         LoadStdProfileSettings();  // Load standard INI file options (including MRU)
44
45         // Register the application's document templates.  Document templates
46         //  serve as the connection between documents, frame windows and views.
47
48         CMultiDocTemplate* pDocTemplate;
49         pDocTemplate = new CMultiDocTemplate(
50                 IDR_2DTYPE,
51                 RUNTIME_CLASS(CViewer2dDoc),
52                 RUNTIME_CLASS(OCC_2dChildFrame),
53                 RUNTIME_CLASS(OCC_2dView));
54         AddDocTemplate(pDocTemplate);
55
56         // create main MDI Frame window
57         OCC_MainFrame* pMainFrame = new OCC_MainFrame;
58         if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
59                 return FALSE;
60         m_pMainWnd = pMainFrame;
61
62         // Parse command line for standard shell commands, DDE, file open
63         CCommandLineInfo cmdInfo;
64         ParseCommandLine(cmdInfo);
65
66         // Dispatch commands specified on the command line
67         if (!ProcessShellCommand(cmdInfo))
68                 return FALSE;
69
70         // The main window has been initialized, so show and update it.
71         pMainFrame->ShowWindow(m_nCmdShow);
72         pMainFrame->UpdateWindow();
73
74         return TRUE;
75 }