OSDN Git Service

2011/11/22 1:05:04
[nlite/nlite.git] / nlite / nlite.cpp
1 // nlite.cpp : \83A\83v\83\8a\83P\81[\83V\83\87\83\93\82Ì\83G\83\93\83g\83\8a \83|\83C\83\93\83g\82ð\92è\8b`\82µ\82Ü\82·\81B
2 //
3
4 #include "stdafx.h"
5 #include "nlite_include.h"
6 using namespace nlite;
7
8 CAppModule _Module;
9
10 const nlite::CApplicationInfo* appInfo = NULL;
11
12
13
14
15 static BOOL InitializeNlite();                                  //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8f\89\8aú\89»
16 static VOID FinalizeNlite();                                    //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8fI\97¹\8f\88\97\9d
17 int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE,
18         LPTSTR lpCmdLine, int nCmdShow)
19 {
20    
21         int nRet = -1;
22         try{
23                 if(_Module.Init(NULL, hInstance) != S_OK){
24                         throw AppInitException();
25                 }
26                         
27                 if(InitializeNlite() != TRUE){
28                         throw AppInitException();
29                 }
30                 
31
32                 
33                 CMessageLoop theLoop;
34                 _Module.AddMessageLoop(&theLoop);
35
36                 // \93Æ\8e©\83E\83B\83\93\83h\83E\82ð\8dì\90¬
37                 CNliteMainFrame wnd;
38                 wnd.CreateEx(0,0,WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN);
39                 wnd.ShowWindow(nCmdShow);
40                 wnd.UpdateWindow();
41
42                 _heapmin();
43
44                 nRet = theLoop.Run();
45
46                 vcassert(_heapchk() == -2,TEXT("\83q\81[\83v\83G\83\89\81[\82Å\82·"));
47
48                 _Module.RemoveMessageLoop();
49         } catch(Exception e){
50
51                 MessageBox(NULL,e.what(),TEXT("\83A\83v\83\8a\83P\81[\83V\83\87\83\93\83G\83\89\81["),MB_OK);
52         }catch(std::exception e){
53
54                 MessageBoxA(NULL,e.what(),"\83A\83v\83\8a\83P\81[\83V\83\87\83\93\83G\83\89\81[",MB_OK);
55         } 
56
57         FinalizeNlite();
58         _Module.Term();
59
60         return nRet;
61 }
62
63 static BOOL InitializeNlite(){
64
65         BOOL rslt = FALSE;
66
67         try{
68
69                 appInfo = &CApplicationInfo::getInstance();
70                 
71
72         }catch (AppInitException e){
73
74                 return rslt;
75
76         }
77
78         rslt = TRUE;
79
80
81         return rslt;
82 }
83
84
85  VOID FinalizeNlite(){
86
87
88
89          return;
90  }