使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 0408576e9da10015ffa9da0079b8c985113ce4b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
ÿþ// dui-demo.cpp : main source file
//
 
#include "stdafx.h"
#include "MainDlg.h"
#include "MBRealWndHandler.h"
 
//ÎNPE‡eöN R} ÿèlaÎN‡eöN R}ï„_MOn
#define RES_TYPE 0
//#define SYSRES_TYPE 0
// #define RES_TYPE 0   //PE
// #define RES_TYPE 1   //ZIP
// #define RES_TYPE 2   //7z
// #define RES_TYPE 2   //‡eöN
//»S‰cYy˜/ec ÿåNMQãNx>f—_÷mqN
#if (RES_TYPE==1)
#include "resprovider-zip\zipresprovider-param.h"
#else 
#if (RES_TYPE==2)
#include "resprovider-7zip\zip7resprovider-param.h"
#endif
#endif
#ifdef _DEBUG
#define SYS_NAMED_RESOURCE _T("soui-sys-resourced.dll")
#else
#define SYS_NAMED_RESOURCE _T("soui-sys-resource.dll")
#endif
 
#if defined DEBUG || defined _DEBUG
    const TCHAR kSubProcess[] = _T("mbsubprocess.exe");
    //const TCHAR kCdnProcess[] = _T("mbcdn.exe");
#else
    const TCHAR kSubProcess[] = _T("mbsubprocess.exe");
    //const TCHAR kCdnProcess[] = _T("mbcdn.exe");
#endif
 
 
 
// .dump
CMiniDumper g_miniDumper(true);
// KmՋO(u„v§c6RðS_sQ
bool g_bUseConsole = false;
 
 
 
/*freopen( "CONOUT$","w",stdout);
    printf("test\n");    */
// end KmՋO(u„v§c6RðS_sQ
// ‰[ňW[SO
void InstallResourceFont(HINSTANCE hResInstance, LPCTSTR lpsFont, LPCTSTR lpsType)  
{  
    HRSRC hRes = FindResource(hResInstance, lpsFont, lpsType);  
    if(hRes)   
    {  
        HGLOBAL hMem = LoadResource(hResInstance, hRes);  
        void *pData = LockResource(hMem);  
        DWORD dwLen = SizeofResource(hResInstance, hRes);  
        DWORD dwFonts = 0;  
        HANDLE m_hFont = AddFontMemResourceEx(  
            pData,          // font resource   
            dwLen,          // number of bytes in font resource    
            NULL,           // Reserved. Must be 0.   
            &dwFonts);      // number of fonts installed   
        if(m_hFont == NULL)  
        {
            
        }
    }  
}   
 
// RËYSꁚ[IN„v9_úQ—z
bool InitMsgBox()
{
    pugi::xml_document xmlDoc;
    if(!LOADXML(xmlDoc,_T("DLG_XML_MSGBOX"),_T("LAYOUT"))
    || !SetMBMsgTemplate(xmlDoc.child(L"SOUI")))
    {
         return false;
    } 
    return true;
}
 
//š[IN/UN„vN*NR,UIRESù[aŒ,ROBJ_IN_CPP/fresource.h-Nš[IN„v[0
ROBJ_IN_CPP
bool ProcessParam( CString strCmd,CString &strServer,int    &nPort,CString &strLoginName,CString &strPassword,int    &nStartLoginTime )
{
    CString            strCmdLine;
    CString            strParam;
    BOOL            bRetValue = false;
 
    strCmdLine    = strCmd;
    strParam    = strCmdLine;
 
    CStringArray    asVarName, asValue;
    CString            strPort;
    CString            strVarName;
    CString            strLoginTime;
    int                nIndex, nCount;
 
    strServer = _T("");
    strLoginName = _T("");
    strPassword = _T("");
    nPort  = DEFAULTPORT_ORG;
    nStartLoginTime = 0;
    CBaseStringMgr::GetParam( strParam, asVarName, asValue, _T(";") );
    nCount = asVarName.GetSize( );
    if ( nCount <= 0 )
    {
        return true;
    }
    for ( nIndex = 0; nIndex < nCount; nIndex++ )
    {
        strVarName = asVarName.GetAt( nIndex );
        if ( strVarName.CompareNoCase( _T("Server") ) == 0 )
        {
            strServer        = asValue.GetAt( nIndex );
        }
        else if ( strVarName.CompareNoCase( _T("LoginName") ) == 0 )
        {
            strLoginName    = asValue.GetAt( nIndex );
        }
        else if ( strVarName.CompareNoCase( _T("Password") ) == 0 )
        {
            strPassword        = asValue.GetAt( nIndex );
        }
        else if ( strVarName.CompareNoCase( _T("Port") ) == 0 )
        {
            strPort            = asValue.GetAt( nIndex );
            nPort            = _ttoi( strPort );
        }    
        else if ( strVarName.CompareNoCase( _T("LoginTime") ) == 0 )
        {
            strLoginTime        = asValue.GetAt( nIndex );
            nStartLoginTime            = _tstoi( strLoginTime );
            if(nStartLoginTime > 10 )
                nStartLoginTime = 0;
        }
    }
    return true;
}
unsigned int _stdcall ThreadFunctionLogoutUser(void *pV)
{
    CMBServerMgr *pSvrMgr = (CMBServerMgr *)pV;
    if ( pSvrMgr )
    {
        try
        {
            CMBSecCoreWebCMgr *pMBSecCoreWebCMgr  = new CMBSecCoreWebCMgr(); 
            pMBSecCoreWebCMgr->SetServerInfo(_T("127.0.0.1"),PORT_SECCOREWEBS,_T("MBC"));
            pMBSecCoreWebCMgr->SetAuthKey(KEY_OIPS_WRITE);
            CString strOrgServerInfo;
            CString strLoginName = pSvrMgr->GetUserLogin()->m_strLoginName;
            strOrgServerInfo.Format(_T("%s:%s"), pSvrMgr->GetUserLogin()->m_strServerName,pSvrMgr->GetUserLogin()->m_strPort   );
            pMBSecCoreWebCMgr->LogoutUser(strOrgServerInfo, strLoginName);
            delete pMBSecCoreWebCMgr;
        }
        catch(...)
        {
        }
    }
    _endthreadex( 0 );
    return 0;
}
//void UpdateSTKAppPack( )
//{
//    CString strUpsUpdateFilePath;;
//    strUpsUpdateFilePath.Format( _T("%s\\mbupdate.exe"),CBaseCommFun::GetModulePath( ) );
//    if ( GetFileAttributes( strUpsUpdateFilePath ) != -1 )
//    {
//        CString strParam = _T("AppProcName=mbcU.exe;Server=39.100.64.174;Port=5018;AppFlag=MBC;CurVer=1.2.1;FileSFlag=Default;FileS=39.100.64.174;FileSPort=5012");
//        //#ifndef _DEBUG
//        CString strUpsUpdateFileDir;
//        strUpsUpdateFileDir = CBaseCommFun::GetPathName( strUpsUpdateFilePath );
//        ::ShellExecute( NULL, _T("open"),strUpsUpdateFilePath, strParam,strUpsUpdateFileDir, SW_SHOWNORMAL );
//    }
//}
BOOL DeleteDir( CString strDir )
{
    CString            strTmpPath;
    WIN32_FIND_DATA wfd;  
    BOOL            bRet = TRUE;
    int                nCnt =0;
    strTmpPath.Format(_T("%s\\*.*"), strDir);
    HANDLE hFind = FindFirstFile(strTmpPath,&wfd);   
    if(hFind == INVALID_HANDLE_VALUE)
    {
        return TRUE;
    }
    do
    {
        if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 
        {
            if ( _tcscmp( wfd.cFileName, _T( ".." ) ) == 0 
            || _tcscmp( wfd.cFileName, _T( "." ) ) == 0 )
                continue ;
            strTmpPath.Format(_T("%s\\%s"), strDir, wfd.cFileName); 
            DeleteDir(strTmpPath);
        }
        else
        {
            nCnt++;
            strTmpPath.Format(_T("%s\\%s"), strDir, wfd.cFileName); 
            DeleteFile(strTmpPath);
                
        }
    }
    while(FindNextFile(hFind,&wfd));   
    FindClose(hFind);
    RemoveDirectory(strDir);
    return bRet;
}
BOOL DeleteCefDir( CString strDir )
{
    CString            strTmpPath;
    WIN32_FIND_DATA wfd;  
    BOOL            bRet = TRUE;
    int                nCnt =0;
    CString        strFileName;
    strTmpPath.Format(_T("%s\\*.*"), strDir);
    HANDLE hFind = FindFirstFile(strTmpPath,&wfd);   
    if(hFind == INVALID_HANDLE_VALUE)
    {
        return TRUE;
    }
    do
    {
        if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 
        {
            if ( _tcscmp( wfd.cFileName, _T( ".." ) ) == 0 
            || _tcscmp( wfd.cFileName, _T( "." ) ) == 0 )
                continue ;
            strFileName.Format(_T("%s"), wfd.cFileName); 
            if(strFileName.CompareNoCase(_T("Resources")) == 0)
                continue ;
            strTmpPath.Format(_T("%s\\%s"), strDir, wfd.cFileName); 
            DeleteDir(strTmpPath);
        }
        else
        {
            nCnt++;
            strTmpPath.Format(_T("%s\\%s"), strDir, wfd.cFileName); 
            DeleteFile(strTmpPath);
                
        }
    }
    while(FindNextFile(hFind,&wfd));   
    FindClose(hFind);
    return bRet;
}
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int /*nCmdShow*/)
{  
    HRESULT hRes = OleInitialize(NULL);
    SASSERT(SUCCEEDED(hRes));
    // RËYSž[‹OåSÄg 
    afxCurrentInstanceHandle = _AtlBaseModule.GetModuleInstance();
    afxCurrentResourceHandle = _AtlBaseModule.GetResourceInstance();
 
    CString strCfgName,strModulePath; 
    int nRet = 0;
 
    //UpdateSTKAppPack( );
    SComMgr *pComMgr = new SComMgr;
    TCHAR szCurrentDir[MAX_PATH] = { 0 };
    GetModuleFileName(NULL, szCurrentDir, sizeof(szCurrentDir)); 
    LPTSTR lpInsertPos = _tcsrchr(szCurrentDir, _T('\\'));
 
    // M‘n‡eöN 
    _tcscpy(lpInsertPos + 1, _T("\0"));
    strModulePath = szCurrentDir;
     
#ifdef _DEBUG
    _tcscpy(lpInsertPos + 1, _T("..\\mbc"));
#else
    _tcscpy(lpInsertPos + 1, _T("\0"));
#endif
    SetCurrentDirectory(szCurrentDir);
    //  R}ê&^„vriched20.DLL,vQž[/fmsftedit.dll.
    // ‚YœgO(uû|ß~„vriched20.dll ÿ(W¡‹—{)ۏI{¹eb—    g˜,ŸSàV*gåg
    SStringW re = szCurrentDir;
    re += L"\\riched20.dll";
    LoadLibrary(re);
    {
        BOOL bLoaded = FALSE;
 
        // soui R}Dn
        CAutoRefPtr<SOUI::IImgDecoderFactory> pImgDecoderFactory;
        CAutoRefPtr<SOUI::IRenderFactory> pRenderFactory;
        bLoaded = pComMgr->CreateRender_Skia((IObjRef**)&pRenderFactory);
        //bLoaded = pComMgr->CreateRender_GDI((IObjRef**)&pRenderFactory);
        
        SASSERT_FMT(bLoaded, _T("load interface [render] failed!"));
        bLoaded = pComMgr->CreateImgDecoder((IObjRef**)&pImgDecoderFactory);
        SASSERT_FMT(bLoaded, _T("load interface [%s] failed!"), _T("imgdecoder"));
 
        pRenderFactory->SetImgDecoderFactory(pImgDecoderFactory);
        SApplication *theApp = new SApplication(pRenderFactory, hInstance);
        // skin
        theApp->RegisterSkinClass<CMBSkin>();
        theApp->RegisterSkinClass<SSkinGif>();//èlŒQSkinGif
         //extened skins
        theApp->RegisterSkinClass<SColorMask>();
        theApp->RegisterSkinClass<SAntialiasSkin>();
        theApp->RegisterSkinClass<SSkinVScrollbar>();
 
        theApp->RegisterWindowClass<SSnapshotCtrl>();
        theApp->RegisterWindowClass<CEdit9527>();
        theApp->RegisterWindowClass<CSnapshotMagnifierCtrl>();
#ifdef _DEBUG
        //    éb†NÅN(WReleaseHr,gSbSDnRû|ß~Dn(WDEBUG NËYÈ~O(uDLL R}
        {
            HMODULE hModSysResource = LoadLibrary(SYS_NAMED_RESOURCE);
            if (hModSysResource)
            {
                CAutoRefPtr<IResProvider> sysResProvider;
                CreateResProvider(RES_PE, (IObjRef**)&sysResProvider);
                sysResProvider->Init((WPARAM)hModSysResource, 0);
                theApp->LoadSystemNamedResource(sysResProvider);
                FreeLibrary(hModSysResource);
            }
            else
            {
                SASSERT(0);
            }
        }
#else        
        //ÎNDLL R}û|ß~Dn         
        {
            HMODULE hModSysResource = LoadLibrary(SYS_NAMED_RESOURCE);
            if (hModSysResource)
            {
                CAutoRefPtr<IResProvider> sysResProvider;
                CreateResProvider(RES_PE, (IObjRef**)&sysResProvider);
                sysResProvider->Init((WPARAM)hModSysResource, 0);
                theApp->LoadSystemNamedResource(sysResProvider);
                FreeLibrary(hModSysResource);
            }
            else
            {
                SASSERT(0);
            }
        }
#endif
 
        CAutoRefPtr<IResProvider>   pResProvider;
 
#ifdef _DEBUG        
        //    éb†NÅN(WReleaseHr,gSbSDnR(WDEBUG NËYÈ~O(u‡eöN R}
        {
            CreateResProvider(RES_FILE, (IObjRef**)&pResProvider);
            bLoaded = pResProvider->Init((LPARAM)_T("uires"), 0);
            SASSERT(bLoaded);
        }
#else
        {
            CreateResProvider(RES_PE, (IObjRef**)&pResProvider);
            bLoaded = pResProvider->Init((WPARAM)hInstance, 0);
            SASSERT(bLoaded);
        }
#endif
 
        // w¹[—zãS„vO(u
        CMBRealWndHandler *pRealWndHandler = new CMBRealWndHandler;
        theApp->SetRealWndHandler(pRealWndHandler);
        pRealWndHandler->Release();
 
        //èlŒQµ~TÚn¨Rag®v¤€
        theApp->RegisterSkinClass<SSkinNewScrollbar>();
        // RËYSDn
        theApp->InitXmlNamedID(namedXmlID, ARRAYSIZE(namedXmlID), TRUE);
        theApp->AddResProvider(pResProvider);
        // RËYSꁚ[IN„v9_úQ—z
        InitMsgBox();
        // èlŒQmb
        //SWkeLoader wkeLoader;
        //if(wkeLoader.Init(_T("node.dll")))        
        //    theApp->RegisterWindowClass<SWkeWebkit>();//èlŒQWKEOmȉhV
 
        //theApp->RegisterWindowClass<SShellNotifyIcon>();
 
        theApp->RegisterWindowClass<STurn3dView>();
        theApp->RegisterWindowClass<SShellNotifyIcon>();        
        theApp->RegisterWindowClass<SRadioBox2>();//èlŒQRadioBox2
        theApp->RegisterWindowClass<SRadioEx>();//èlŒQRadioBox2
        theApp->RegisterWindowClass<SIconButton>();//èlŒQIconButton
        theApp->RegisterWindowClass<CMBDocTreeView>();
        theApp->RegisterWindowClass<CMBPathCtrl>();//èlŒQ AddressBarCtrl 
        theApp->RegisterWindowClass<STileViewEx>(); // èlŒQ STileViewEx
        theApp->RegisterWindowClass<SImageWndEx>(); // èlŒQ SImageWndEx
 
        theApp->RegisterWindowClass<SMCListViewEx>();
        theApp->RegisterWindowClass<SHeaderCtrlEx>();
        theApp->RegisterWindowClass<SImageCenter>();
        theApp->RegisterWindowClass<SRoundImageCenter>();
        // Rhˆ'T
        theApp->RegisterWindowClass<CMBSearchMCListView>();
 
        theApp->RegisterWindowClass<CMBTreeViewEx>();
        theApp->RegisterWindowClass<SUserTreeView>();
        
        theApp->RegisterWindowClass<SCheckBox2>();
        theApp->RegisterWindowClass<SAniWindow>();
 
        // data
        theApp->RegisterWindowClass<CMBDataGroupList>();
        theApp->RegisterWindowClass<CMBDataTileNav>();
        // doc
        theApp->RegisterWindowClass<CMBAppGroupList>();
        theApp->RegisterWindowClass<CMBAppTileNav>();
      
        // SRoundImage
        theApp->RegisterWindowClass<SRoundImage>();    
 
        // PageCtrl
        theApp->RegisterWindowClass<SPageCtrl2>();
        theApp->RegisterWindowClass<SPageCtrl>();    
        theApp->RegisterWindowClass<SPageNo>();     
 
        // Tag
        theApp->RegisterWindowClass<STag>();     
        theApp->RegisterWindowClass<STagView>(); 
 
        // SRatingBarEx
        theApp->RegisterWindowClass<SRatingBarEx>(); 
 
        //VerListView
        theApp->RegisterWindowClass<CMBVerListView>(); 
        //MCListView
        theApp->RegisterWindowClass<CMBMCListView>(); 
        //MBScrollView
        theApp->RegisterWindowClass<CMBScrollView>(); 
        //MBDateTimePicker
        theApp->RegisterWindowClass<CMBDateTimePicker>(); 
        //MBComboBox
        theApp->RegisterWindowClass<CMBComboBox>(); 
        //MBWindowEx
        theApp->RegisterWindowClass<CMBWindowEx>(); 
        //MBDocSTreeView
        theApp->RegisterWindowClass<CMBDocSTreeView>(); 
        // MBMcListViewEx
        theApp->RegisterWindowClass<CMBMcListViewEx>(); 
        // MBVaultTreeView
        theApp->RegisterWindowClass<CMBVaultTreeView>(); 
        theApp->RegisterWindowClass<SQrCtrl>(); 
        theApp->RegisterWindowClass<CMBFireListCtrl>(); 
 
        theApp->RegisterWindowClass<SButtonEx>();
        theApp->RegisterWindowClass<SWindowEx>();
        theApp->RegisterWindowClass<SSplitBar>();
        theApp->RegisterWindowClass<SImageView>();
        theApp->RegisterWindowClass<SImRichEdit>();
        theApp->RegisterWindowClass<SChatEditLog>();
        theApp->RegisterWindowClass<SChatEditMsg>();
        theApp->RegisterWindowClass<SEditOrgUser>();
        theApp->RegisterWindowClass<SGifPlayer>(); 
        theApp->RegisterWindowClass<CMBAutoRadio>(); 
        //theApp->RegisterWindowClass<SWebView>(); // èlŒQ cef„v§cöN
        // ‰[ňW[SOþVh
        InstallResourceFont(SApplication::getSingleton().GetInstance(), MAKEINTRESOURCE(IDR_TTF_MOBOXICON), _T("TTF"));
        InstallResourceFont(SApplication::getSingleton().GetInstance(), MAKEINTRESOURCE(IDR_TTF_USERFONT), _T("TTF"));
        // Ê‘>e(Wmain-N 
        CMBServerMgr *pSvrMgr = new CMBServerMgr();
        //pSvrMgr->m_strModulePath = strModulePath;
        CMBCfgInfo *pCfgInfo = pSvrMgr->GetCfgInfo();
        strCfgName.Format( _T("%s\\data\\mbcConfig.ini"),CBaseCommFun::GetWorkDir() );
        pCfgInfo->ReInit(strCfgName);
        // KmՋO(u„v§c6RðS wah 20181110
        if( g_bUseConsole )
            AllocConsole();
        // BLOCK: Run application         
        {    
            //$R­e z^/f&T    gÂSpe
            CString strServer = _T("");
            CString strLoginName = _T("");
            CString strPassword = _T("");
            int nPort  = DEFAULTPORT_ORG;
            int nStartLoginTime = 0;
            ProcessParam(lpstrCmdLine,strServer,nPort,strLoginName, strPassword, nStartLoginTime);
            /*if(strServer.IsEmpty() && strLoginName.IsEmpty() && strPassword.IsEmpty())
            {
                return;
            }
            else if( !strServer.IsEmpty() && !strLoginName.IsEmpty() && !strPassword.IsEmpty())
            {
                return;
            }*/
            /*strServer = _T("116.62.155.124");
            strLoginName = _T("test7");
            strPassword = _T("000000");
            nStartLoginTime =10;*/
            // RËYS{vU_—z
            CMBLoginWnd dlLgoin;  
            dlLgoin.SetSvrMgr(pSvrMgr);
            dlLgoin.SetCurLoginInfo(strServer,nPort,strLoginName, strPassword,nStartLoginTime);
            dlLgoin.Create(GetActiveWindow(), 0, 0, 0, 0);
            dlLgoin.SendMessage(WM_INITDIALOG);
            dlLgoin.CenterWindow(dlLgoin.m_hWnd);
            dlLgoin.AnimateHostWindow(200, AW_CENTER);
            if(nStartLoginTime > 0)
            {
                if( !strServer.IsEmpty() && !strLoginName.IsEmpty())
                    dlLgoin.ShowWindow(SW_HIDE);
                else
                {
                    if( pSvrMgr->GetCfgInfo()->m_strAutoLogin == _T("1") )
                        dlLgoin.ShowWindow(SW_HIDE);
                }
            }
            nRet = theApp->Run(dlLgoin.m_hWnd);
             // O(uåw-NÃ_„vˆmo`:g6R
            SNotifyCenter* pNotifyCenter = new SNotifyCenter; 
            if (dlLgoin.GetReturnCode() == 0)
            {
                CString szPropName;
                HANDLE    hValue = (HANDLE)1;
                if( !CBaseCommFun::CheckProcessExist(_T("OIPSecCore.exe")))
                {
                    CBaseCommFun::StartServer( _T("OIPSecCore") );
                }
                if( CBaseCommFun::CheckProcessExist(_T("OIPSecCore.exe")))
                {
                    CString strOrgServerInfo;
                    strOrgServerInfo.Format(_T("%s:%s"), pSvrMgr->GetUserLogin()->m_strServerName,pSvrMgr->GetUserLogin()->m_strPort   );
                    pSvrMgr->GetSecCoreWebCMgr()->RegisterUser(strOrgServerInfo,pSvrMgr->GetUserLogin()->m_strOrgServerID,
                        pSvrMgr->GetUserLogin()->m_strLoginName, pSvrMgr->GetUserLogin()->m_strUserName, pSvrMgr->GetUserLogin()->m_strAliasName, pSvrMgr->GetUserLogin()->m_strSessionID);
                }
                szPropName.Format( _T("MBC_%s-%s-%s"), pSvrMgr->GetUserLogin()->m_strServerName, pSvrMgr->GetUserLogin()->m_strPort, pSvrMgr->GetUserLogin()->m_strLoginName );
                szPropName.MakeLower();
                // RËYScef
                pSvrMgr->GetUserLogin()->m_nMBCShowMode = pSvrMgr->GetCfgInfo()->m_iniFile.GetProfileInt(_T("MBC_BASE"),_T("ShowMode"));     
                CCef3RunEngine  *pCef3RunEngine = new CCef3RunEngine();
                pCef3RunEngine->Initialize(theApp,hInstance);
                // RËYS;NLub—
                CMainDlg dlgMain;
                dlgMain.SetSvrMgr( pSvrMgr );                
                //dlgMain.Create(GetActiveWindow(),WS_POPUP | WS_DLGFRAME | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,NULL,0,0,0,0);
                dlgMain.Create(GetActiveWindow(),WS_POPUP |  WS_CLIPSIBLINGS | WS_CLIPCHILDREN,NULL,0,0,0,0);
                //dlgMain.Create(GetActiveWindow());  
                dlgMain.SendMessage(WM_INITDIALOG);
                dlgMain.CenterWindow( dlgMain.m_hWnd);
                dlgMain.ShowWindow(SW_SHOWNORMAL);
                nRet = theApp->Run(dlgMain.m_hWnd);
                BOOL bCleanWebCach = dlgMain.IsCleanWebCache();
                // sQí•cef
                pCef3RunEngine->Release();
                if( pCef3RunEngine )
                {
                    delete pCef3RunEngine;
                    pCef3RunEngine = NULL;
                }
                if( CBaseCommFun::CheckProcessExist(_T("OIPSecCore.exe")))
                {
                    unsigned int             nThreadID;
                   ::_beginthreadex(0, 0, ThreadFunctionLogoutUser, (void*)pSvrMgr, 0, &nThreadID);
                }
                if(bCleanWebCach)
                {
                    CString strTempDir;
                    strTempDir.Format(_T("%s\\cef"),CBaseCommFun::GetModulePath(  ));
                    if( GetFileAttributes( strTempDir)  != -1)
                        DeleteCefDir(strTempDir);
                }
            }  
            delete pNotifyCenter;
        }
        // KmՋO(u„v§c6RðS wah 20181110
        if( g_bUseConsole )
           FreeConsole();
        
        delete theApp;
        //// nd–  
        if( pSvrMgr != NULL )
        {
            delete pSvrMgr;
            pSvrMgr = NULL;
        }
    }
 
    delete pComMgr;
    OleUninitialize();
    // cef    göeOúQ°sP[ۏ z*gúQ„v˜ ÿàVdk(Wُ̑Kb¨Rʑ>e
    //CMBProcessOpt::KillProcessFromName(kSubProcess);
    // 
    //CMBProcessOpt::KillProcessFromName(kCdnProcess);    
    // window ˆmo`ª_¯sò]Ï~Ó~_g ÿ@b    gDnýò]Ï~ʑ>e ÿFO    göe ÿ¿~ zbۏ z`S(uû|ß~Dn ÿû|ß~ʑ>e„vöeô•Ǐ• ÿŒ(uُ*N¹eÕlïSåNËz;R¿~_g
    CMBProcessOpt::TerminateApp();  // ïSý€¡l    g(u ÿHQ™Q(Wُ̑ ÿÏQ\ù[ z^úQ„vÅbç_
 
    return nRet;
}