OSDN Git Service

NCVのリスナー情報同期処理
[nlite/nlite.git] / nlite / nlite.cpp
index 9fe2b97..8872a48 100644 (file)
@@ -8,14 +8,8 @@ CAppModule _Module;
 
 
 
-namespace nlite{
 
-Property nliteProperty;        
 
-const CApplicationInfo * appInfo = NULL;
-
-}
-static TCHAR localAppDataPath[_MAX_PATH];
 
 static WSAData wsaData;                                                        //winsockdata
 static HINTERNET hInternet = NULL;
@@ -28,19 +22,23 @@ static CNliteMainFrame wnd;                                         //
 int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE,
        LPTSTR lpCmdLine, int nCmdShow)
 {
-   
+       HINSTANCE hRich = LoadLibrary(CRichEditCtrl::GetLibraryName());
        int nRet = -1;
        try{
 
                //
                //\83A\83v\83\8a\83P\83P\81[\83V\83\87\83\93\8f\89\8aú\89»\8f\88\97\9d
                //
-
-               InitCommonControls();
-
-               if(_Module.Init(NULL, hInstance) != S_OK){
+               HRESULT hRes = ::CoInitialize(NULL);
+               ATLASSERT(SUCCEEDED(hRes));
+               //InitCommonControls();
+                AtlInitCommonControls(ICC_COOL_CLASSES | ICC_WIN95_CLASSES);
+                GUID guid;
+               if(_Module.Init(NULL, hInstance,&guid) != S_OK){
                        throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
                }
+
+               AtlAxWinInit();
                        
                if(InitializeNlite() != TRUE){
                        throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
@@ -85,6 +83,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE,
                
                UnexpectedErrorMessageShow(TEXT("nlib\82Å\83n\83\93\83h\83\8b\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81["),e.what(),e.getLineNo(),e.getFileName(),e.getFunctionName());
                
+               goto nlitefinally;
        }catch(std::exception &e){
                UnexpectedErrorMessageShow(TEXT("\83n\83\93\83h\83\8b\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81["),CComBSTR(e.what()),-1,TEXT("\94­\90\83t\83@\83C\83\8b\82ª\93Á\92è\8fo\97\88\82Ü\82¹\82ñ"),TEXT("\94­\90\8aÖ\90\94\82ª\93Á\92è\82Å\82«\82Ü\82¹\82ñ"));
 
@@ -96,14 +95,14 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE,
 nlitefinally:
        wnd.OnException();
        wnd.DestroyWindow();
-
+       FreeLibrary(hRich);
 
 nliteend:
 
        _Module.RemoveMessageLoop();
        FinalizeNlite();
        _Module.Term();
-
+       ::CoUninitialize();
 
        return nRet;
 }
@@ -160,6 +159,10 @@ static BOOL InitializeNlite(){
                SystemParametersInfo (SPI_SETLISTBOXSMOOTHSCROLLING,FALSE,FALSE,0);
 
 
+               
+               SHGetFolderPathW(0,CSIDL_APPDATA,0,SHGFP_TYPE_CURRENT,appFolderPath);
+               ncvAppSettingPath = appFolderPath;
+               ncvAppSettingPath += TEXT("\\posite-c\\NiconamaCommentViewer\\AppSetting.xml");
        }catch (AppInitException e){
 
                return rslt;
@@ -185,16 +188,3 @@ static BOOL InitializeNlite(){
         return;
  }
 
- VOID nlite::UnexpectedErrorMessageShow(LPCTSTR headMessage,LPCTSTR summary,UINT line,LPCTSTR fileName,LPCTSTR function){
-       tstring errMessage;
-       errMessage = headMessage;
-       errMessage += TEXT("\91z\92è\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81[\82ª\94­\90\82µ\82Ü\82µ\82½\81B\83A\83v\83\8a\83P\81[\83V\83\87\83\93\94z\92u\83t\83H\83\8b\83_\82É\8dì\90¬\82³\82ê\82½\83\8d\83O\83t\83@\83C\83\8b\82ð\93n\82µ\82Ä\82à\82ç\82¦\82é\82Æ\8aJ\94­\8eÒ\82ª\94ñ\8fí\82É\8aì\82Ñ\82Ü\82·");
-       errMessage += TEXT("\r\n\83G\83\89\81[\83\81\83b\83Z\81[\83W:");
-       errMessage += summary;
-       DebugOutW(fileName,function,line,DUMPING__DEBUGER__ | LINEFEAD__DEBUGER__ ,ERRORMODE__DEBUGER__,TEXT("%s"),errMessage);
-       ::MessageBox(NULL,errMessage.c_str(),TEXT("\91z\92è\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81["),MB_ICONERROR | MB_OK);
-       
-
-
-        return;
- }
\ No newline at end of file