使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 479b1995ef435713c2cf4f0da8de3a6af6c30922
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
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
#include "StdAfx.h"
#include "StrFileUtils.h"
#include "Guid.h"
#include "MBFile.h"
 
 
CStrFileUtils::CStrFileUtils(void)
{
}
 
 
CStrFileUtils::~CStrFileUtils(void)
{
 
 
CString CStrFileUtils::GetFileName(CString strFileFullName)  
{  
    int nPos = strFileFullName.ReverseFind('\\'); // Îļþ·¾¶£¬ÒÔ'\'б¸Ü·Ö¸ôµÄ·¾¶   
     
    return strFileFullName.Right(strFileFullName.GetLength() - nPos - 1);     
}  
 
 
CString CStrFileUtils::GetPath(CString strFileFullName)  
{  
    int nPos = strFileFullName.ReverseFind(_T('\\'));  
    CString  strFileName = strFileFullName.Left(nPos+1); // »ñÈ¡ÎļþÃû  
    return strFileName;  
}  
 
CString CStrFileUtils::GetPath1(CString strFileFullName)  
{  
    int nPos = strFileFullName.ReverseFind(_T('\\'));  
    CString  strFileName = strFileFullName.Left(nPos); // »ñÈ¡ÎļþÃû  
    return strFileName;  
}  
 
 
 CString CStrFileUtils::GetSimplePath(CString strFileFullName)
 { 
    int nPos = strFileFullName.ReverseFind(_T('\\'));  
    CString  strFileName = strFileFullName.Left(nPos); // »ñÈ¡ÎļþÃû  
    return strFileName;  
 }
 
 CString CStrFileUtils::GetServerPath(CString strRootPath,CString strServerPath,CString strFilePathName)
 {
     CString strTmpSerPath1,strTmpSerPath2;
 
    if(!IsDirExit( strFilePathName))
    {
        strTmpSerPath1 = GetSimplePath(strFilePathName);
    
    }else{
        strTmpSerPath1 = strFilePathName;
    }
    ////////////////////////////////////////////
    strTmpSerPath1.Replace(strRootPath,_T(""));
    strTmpSerPath1.Replace(_T('\\'),_T('/'));
         
    if( strTmpSerPath1.Find(_T('/')) == 0 )
    {
        if( strServerPath.IsEmpty() )
        {
            strTmpSerPath2 = strTmpSerPath1.Mid(1,strTmpSerPath1.GetLength());
        }else{
            strTmpSerPath2 = strServerPath + strTmpSerPath1;
        }
    }else
    {
        if( strServerPath.IsEmpty() )
        {
            strTmpSerPath2 =  strTmpSerPath1;
        } else
        {
            strTmpSerPath2 = strServerPath + _T("/")+ strTmpSerPath1;
        }
    }
     return strTmpSerPath2;
 }
 
CString CStrFileUtils::GetSimpleFileName(CString strFileFullName)  
{  
    int nPos = strFileFullName.ReverseFind(_T('.'));  
    if( nPos== -1 )
    {
        nPos = strFileFullName.ReverseFind('\\'); 
        return   strFileFullName.Right(strFileFullName.GetLength()-nPos-1);
    }
    CString  strFileName = strFileFullName.Left(nPos); // »ñÈ¡ÎļþÃû  
    nPos = strFileName.ReverseFind('\\'); 
    strFileName = strFileName.Right(strFileName.GetLength()-nPos-1);
    return strFileName;  
}  
 
CString  CStrFileUtils::GetFileExtName(CString strFileFullName)  
{  
    int nPos = strFileFullName.ReverseFind('.'); 
    if( nPos == -1 )
        return _T("");
    CString  strFileExtName = strFileFullName.Right(strFileFullName.GetLength() - nPos); // »ñÈ¡À©Õ¹Ãû  
    return strFileExtName;  
}  
 
CString CStrFileUtils::GetDir( CString strFileName )
{   
    if( IsDirExit(strFileName) )
        return strFileName;
 
    int nPos  = strFileName.ReverseFind('\\'); 
    strFileName = strFileName.Left(nPos );
 
    return strFileName; 
}
 
CString CStrFileUtils::GetRootDir( CString strFileName )
    int nPos  = strFileName.ReverseFind('\\'); 
    if( -1 == nPos )
        return strFileName;
    strFileName = strFileName.Left(nPos );
 
    return strFileName;
}
 
 
bool  CStrFileUtils::DoRemoveDirectory(CString strDirName)
{
    bool result;
    HANDLE Handle;
    WIN32_FIND_DATA fData;
    CString strTemp;
    DWORD errorcode;
 
    Handle = FindFirstFile(strDirName + _T("\\*.*"), &fData);
 
    if (Handle == INVALID_HANDLE_VALUE)
        return FALSE;
 
    do {
        errorcode = GetLastError();
 
        if ( fData.cFileName[0] == '.' )
            continue;
 
        if (fData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY) {
            if (strDirName[strDirName.GetLength()-1] != '\\'){
                TCHAR chA[MAX_PATH];
                CString strA = strDirName+'\\'+ fData.cFileName;
                lstrcpy(chA, strA);
                DoRemoveDirectory(chA);
            }
            else{
                TCHAR chB[MAX_PATH];
                CString strB = strDirName + fData.cFileName;
                lstrcpy(chB, strB);
                DoRemoveDirectory(chB);
            }
 
            strTemp = strDirName + _T("\\") + fData.cFileName;
 
            SetFileAttributes(strTemp, ~FILE_ATTRIBUTE_READONLY);
            if (!RemoveDirectory(strTemp))
                result = FALSE;
            else
                result = TRUE;
        }
        else
        {
            strTemp = strDirName + _T("\\") + fData.cFileName;
            BOOL bl = SetFileAttributes(strTemp, ~FILE_ATTRIBUTE_READONLY);
 
            if (!DeleteFile(strTemp))
                result = FALSE;
            else
                result = TRUE;
        }
 
    }while(FindNextFile(Handle,&fData));
 
    errorcode = GetLastError();
 
    if (errorcode == ERROR_NO_MORE_FILES)//¿ÕĿ¼
    {
        ::RemoveDirectory(strDirName);
        result = TRUE;
    }
 
    if (Handle)
        FindClose(Handle);
    return result;
}
 
// ÅжÏÎļþÊÇ·ñ´æÔÚ
bool CStrFileUtils::IsExist( CString  strFile)
{
    DWORD dwAttrib = GetFileAttributes(strFile);
    return INVALID_FILE_ATTRIBUTES != dwAttrib && 0 == (dwAttrib & FILE_ATTRIBUTE_DIRECTORY);
}
 
bool  CStrFileUtils::IsDirExit( CString strPath )
    DWORD dwAttrib = GetFileAttributes(strPath);
    return INVALID_FILE_ATTRIBUTES != dwAttrib && 0 != (dwAttrib & FILE_ATTRIBUTE_DIRECTORY);
}
 
 
void CStrFileUtils::CreateDir(CString strPath)
{
    CString strWPath = strPath;
    CString strTemp;
    if(!PathFileExists(strPath))//Îļþ¼Ð²»´æÔÚÔò´´½¨
    {
        strPath.TrimLeft(strPath.Left(3));
        int i = strPath.Find(_T("\\"));
        if(i>0)
        {
            strTemp = strWPath.Left(3) + strPath.Left(i);
        }
        else
        {
            strTemp = strWPath;
        }
        strPath.TrimLeft(strPath.Left(i));
        if(!PathFileExists(strTemp))
            CreateDirectory(strTemp,NULL);
 
        while(strPath.Find(_T("\\")) == 0)
        {
            strPath.TrimLeft(strPath.Left(1));
            int j = strPath.Find(_T("\\"));
            if(j > 0)
            {
                strTemp = strTemp + _T("\\") + strPath.Left(j);
                strPath.TrimLeft(strPath.Left(j));
            }
            else
                strTemp = strTemp + _T("\\") + strPath;
            if(!PathFileExists(strTemp))
                CreateDirectory(strTemp, NULL);
        } 
    }  
 
}
 
bool CStrFileUtils::CreateFile( CString strFileName )
{
    // ´´½¨Îļþ¼Ð
    CString strPath =  GetPath(strFileName);
    CreateDir(strPath);
 
    HANDLE  hHandle = ::CreateFile(strFileName,GENERIC_WRITE,FILE_SHARE_READ,NULL,
        OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
    if( hHandle )
    {
        CloseHandle(hHandle);
    }
 
    return true;
}
 
bool CStrFileUtils::CopyTmpIniFile(CString strTmpIniName,CString strIniName)
{
    // ´´½¨Îļþ¼Ð
    CString strPath =  GetPath(strIniName);
    CreateDir(strPath);
    // ¿½±´
    return CopyFile(strTmpIniName,strIniName,true);
}
 
bool    CStrFileUtils::CopySqliteDb3(CString strSrcDb,CString strTargetDb)
{
    // ´´½¨Îļþ¼Ð
    CString strPath =  GetPath(strTargetDb);
    CreateDir(strPath);
    // ¿½±´
    return CopyFile(strSrcDb,strTargetDb,true);
}
 
  
 
CString CStrFileUtils::GetCurModuleDir()
    TCHAR szCurrentDir[MAX_PATH] = { 0 };
    GetModuleFileName(NULL, szCurrentDir, sizeof(szCurrentDir)); 
    LPTSTR lpInsertPos = _tcsrchr(szCurrentDir, _T('\\'));
    _tcscpy(lpInsertPos + 1, _T("\0"));
    return szCurrentDir;
}
 
CString CStrFileUtils::GetLocalDt()
{
    CString strFileTime;
    SYSTEMTIME st; 
    CString strDate; 
    ::GetLocalTime(&st);
    strFileTime.Format(_T("%04d-%02d-%02d %02d:%02d:%02d"),st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st.wSecond); 
    return strFileTime;
}
 
__int64 CStrFileUtils::GetFileSize(CString strFileFullName)
{
    CFileStatus  fStatus;
 
    if ( !CFile::GetStatus( strFileFullName, fStatus ) )
     return false;
    return fStatus.m_size;
 
 
    /*WIN32_FIND_DATA fileInfo; 
    HANDLE hFind; 
    DWORD fileSize; 
    hFind = FindFirstFile(strFileFullName ,&fileInfo); 
    if(hFind != INVALID_HANDLE_VALUE) {
        fileSize = fileInfo.nFileSizeLow;
         
    }
    return fileSize;*/     
}
 
CString CStrFileUtils::GetClustersSize( CString &strPath )
    CString strCluserters;
    double m_dFree = 0;
    int nIndex = strPath.Find(_T(":")); 
    CString firstchar = strPath.Mid(0,nIndex);
    CString strRootPath=firstchar + _T(":\\");
    /*CString strRootPath="E:\\123.txt";*///´ø¸ùĿ¼±ê¼ÇµÄ´ÅÅÌ·ûºÅ
    DWORD dwSectorsPerCluster=0;//ÿ´ØÖÐÉÈÇøÊý
    DWORD dwBytesPerSector=0;//ÿÉÈÇøÖÐ×Ö½ÚÊý
    DWORD dwFreeClusters=0;//Ê£Óà´ØÊý
    DWORD dwTotalClusters=0;//×Ü´ØÊý
    if (GetDiskFreeSpace(strRootPath,&dwSectorsPerCluster,&dwBytesPerSector,
        &dwFreeClusters,&dwTotalClusters))
    {
        //m_dwVolSize=dwTotalClusters*dwSectorsPerCluster*dwBytesPerSector;//²»ÄÜÕâÑù£¬·ñÔòÔ½½ç
        double dd=dwSectorsPerCluster*dwBytesPerSector/(1024.*1024.);
        dd=dd/1024.;
        m_dFree=dwFreeClusters*dd;//¸Ã´ÅÅÌÊ£ÓàÈÝÁ¿×Ü´óС
        strCluserters.Format(_T("%.2lf"),m_dFree);
        if (m_dFree < 1)
        {
             
        }
    } 
    return strCluserters;
}
 
bool    CStrFileUtils::IsEmptyDir( CString &strPath )
     CFileFind ff;
     CString strFilePath; 
     BOOL bFind = ff.FindFile(strPath +  _T("//*.*"));  
 
     while(bFind)
     { 
         bFind = ff.FindNextFile();
         if (ff.IsDots() || ff.IsSystem() || ff.IsHidden())
             continue;         
         // ÊÇĿ¼
         if (ff.IsDirectory())
         {  
            strFilePath = ff.GetFilePath(); 
            if(!IsEmptyDir(strFilePath)){
                 ff.Close();
                return false;
            }
         }
         else
         {
             strFilePath = ff.GetFilePath(); 
             DWORD nFileSize = GetFileSize(strFilePath);
             if( nFileSize != 0 ){
                 ff.Close();
                 return false;        
             }
         }
    }
    ff.Close();
 
    return true;
}
 
bool    CStrFileUtils::HasFileOnNextLevel(CString &strPath)
{
     CFileFind ff;
     CString strFilePath; 
     BOOL bFind = ff.FindFile(strPath +  _T("//*.*"));  
 
     while(bFind)
     { 
         bFind = ff.FindNextFile();
         if (ff.IsDots() || ff.IsSystem() || ff.IsHidden())
             continue;         
         // ÊÇĿ¼
         if (ff.IsDirectory())
         {  
             ff.Close();
             return true;
         }
         else
         {
             strFilePath = ff.GetFilePath(); 
             DWORD nFileSize = GetFileSize(strFilePath);
             if( nFileSize != 0 ){
                 ff.Close();
                 return true;        
             } 
         }
    }
    ff.Close();
 
    return false; 
}
 
CString    CStrFileUtils::GetFileSizeDisplayStr(__int64 u64FileSize)
        CString        strFileSize;
        if (u64FileSize > 1024*1024*1024)
            strFileSize.Format(_T("%.2lf GB"), ((double)u64FileSize)/(1024*1024 * 1024));
        else if (u64FileSize > 1024*1024)
            strFileSize.Format(_T("%.2lf MB"), ((double)u64FileSize)/(1024*1024));
        else if (u64FileSize > 1024)
            strFileSize.Format(_T("%.2lf KB"), ((double)u64FileSize)/1024);
        else
            strFileSize.Format(_T("%d Bytes"), u64FileSize);
 
        return strFileSize;
}
 
CString  CStrFileUtils::GetFileFlowDisplayStr( CString strTime )
{
    CString strYMD,strHMS;
    int n = strTime.FindOneOf(_T(" "));
    strYMD = strTime.Left(n);
    strHMS = strTime.Right(strTime.GetLength() - n -1);
 
    CString strCurYMD;
    SYSTEMTIME st; 
    CString strDate; 
    GetLocalTime(&st);
    strCurYMD.Format(_T("%04d-%02d-%02d"),st.wYear,st.wMonth,st.wDay); 
    if( strCurYMD == strYMD )
    {
        return strHMS;    
    }
    return strYMD;
}
 
CString  CStrFileUtils::GetRemainTimeDisplayStr( __int64 uRemainTime )
{
    if( uRemainTime == 0 )
        return _T("--");
    CString strRemainTime;
    __int64 days = 1000 * uRemainTime / (1000 * 60 * 60 * 24);
    __int64 hours = (1000 * uRemainTime % (1000 * 60 * 60 * 24)) / (1000 *60 * 60);
    __int64 minutes = (1000 * uRemainTime % ( 1000 *  60 * 60)) / (1000 * 60);
    __int64 seconds = (1000 * uRemainTime  % (1000 *60))/1000;
    if( days == 0 )
    {
        strRemainTime.Format(_T("%02I64u:%02I64u:%02I64u"),hours,minutes,seconds );
    }else{
        strRemainTime.Format(_T("%02I64u:%02I64u:%02I64u:%02I64u"),days,hours,minutes,seconds );
    }
    return strRemainTime;
}
 
bool     CStrFileUtils::HasSlashSplit(CString strSvrPath)
{  
    int nPos = strSvrPath.Find(_T('/'));
    if( nPos >= 0 )
        return true; 
 
    return false;
}
  
CString CStrFileUtils::GetLastErrorMessageString(DWORD dwLastError )
{
    LPVOID lpMsgBuf = NULL;
    FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
                  dwLastError, 
                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                               (LPTSTR) &lpMsgBuf, 0, NULL );
 
    CString str = (LPCTSTR)lpMsgBuf;
 
    if( lpMsgBuf != NULL )
        LocalFree(lpMsgBuf);    
 
    return str;
}
 
// ´ò¿ªÎļþ
bool CStrFileUtils::OpenFile(CString strFileName,CString &strErrInfo)
{
    if( !IsExist( strFileName) )  
    {
        strErrInfo = _T("Îļþ²»´æÔÚ");
        return false;
    }
    // ´ò¿ªÎļþ
    SHELLEXECUTEINFO ShExecInfo = {0};
    ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST;
    ShExecInfo.hwnd = NULL;
    ShExecInfo.lpVerb = NULL;
    ShExecInfo.lpFile = strFileName;
    ShExecInfo.lpParameters = _T("");
    ShExecInfo.lpDirectory = NULL;
    ShExecInfo.nShow = SW_SHOW;
    ShExecInfo.hInstApp = NULL;
    ShellExecuteEx(&ShExecInfo); 
    return true;
}
 
// Îļþ¼Ð
bool CStrFileUtils::OpenFolder(CString strPath,CString &strErrInfo)
{
    CString strParam;
    strParam.Format(_T("/select, %s"),strPath);  
 
    SHELLEXECUTEINFO ShExecInfo = {0};
    ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST;
    ShExecInfo.hwnd = NULL;
    ShExecInfo.lpVerb =  NULL;
    ShExecInfo.lpFile =  _T("explorer.exe");
    ShExecInfo.lpParameters = strParam;
    ShExecInfo.lpDirectory = NULL;
    ShExecInfo.nShow = SW_SHOW;
    ShExecInfo.hInstApp = NULL;
    ShellExecuteEx(&ShExecInfo); 
    return true;
}
 
// µÃµ½ÎļþÐÞ¸Äʱ¼ä
CString  CStrFileUtils::GetFileMdyTime(CString strFileName)
    CString strMdyTime;
    CFileStatus status; 
    if( CFile::GetStatus( strFileName, status ) )   // static function
    {
        CTime create_time=status.m_ctime   ;
        CTime last_modified_time=status.m_mtime   ;
        strMdyTime = last_modified_time.Format("%Y-%m-%d %H:%M:%S");
         
    } 
    return strMdyTime;
}
 
// Ð´Îļþ
bool   CStrFileUtils::WriteFile( CString strFileName,CString strContent,CString &strErrInfo )
{
    CString strPath;
 
    try{ 
            strPath =  GetSimplePath(strFileName);
 
            CStrFileUtils::CreateDir(strPath);
 
            WORD unicode = 0xFEFF; 
            CFile file; 
            file.Open( strFileName,  CFile::modeCreate|CFile::modeWrite );            
            file.Write(&unicode,2); 
            file.Write(strContent,    strContent.GetLength()*2);
            file.Close();
                 
        }
        catch( ... )
        {
            strErrInfo = strFileName + _T(" Ð´Ê§°Ü£¡");
            return false;
        }
    return true;
}
 
 
// µÃµ½Ä¿Â¼Ãû³Æ
CString  CStrFileUtils::GetDirName( CString strFileID )
{
    strFileID.Replace(_T("{"),_T(""));
    strFileID.Replace(_T("}"),_T(""));
 
    CString strDir;
    CGuid guid;
    guid.FromString1(strFileID);
 
    int nDir = (guid.m_guid.Data1 + guid.m_guid.Data2 + guid.m_guid.Data3)  % 99;
    strDir.Format(_T("%d"),nDir);
 
    return strDir;
}
 
 
bool CStrFileUtils::GetStrFromFile( CString strFileName, CString &strBuf )
{
    CFile                    file;
    HLOCAL                    memBuffer;
    CMBFile::e_FileType        eFileType   = CMBFile::eAutoFileType;
    CMBFile::e_FileFormat    eFileFormat = CMBFile::eAutoFileFormat;
    DWORD                    dwNewSize,dwSize;
    TCHAR                    *pBuffer = NULL;
 
    TRY
    {        
        if ( !file.Open( strFileName, CFile::shareDenyWrite | CFile::modeRead ) )
            return false;
 
        // µÃµ½ÎļþÀàÐÍ
        CMBFile::GetFileType( &file,eFileType,dwSize);
        file.SeekToBegin();
         
        if( eFileType == CMBFile::eANSI )
        {
            //    *********************¶ÁÈ¡Îļþ******************************************************************/
            LONGLONG ansifilelen = file.GetLength();//»ñµÃansi±àÂëÎļþµÄÎļþ³¤¶È
            char *p = new char[ansifilelen + 1];//newÒ»¿éÐÂÄÚ´æ
            file.Read(p, ansifilelen);
            p[ansifilelen] = '\0';
 
            LONGLONG unicodefilelen = MultiByteToWideChar(CP_ACP, 0, p, strlen(p), NULL, 0);//°ÑansiÎļþ³¤¶ÈתΪUnicodeÎļþ³¤¶È
 
            wchar_t *wp = new wchar_t[unicodefilelen + 1];//newÒ»¿éÐÂÄÚ´æ
            MultiByteToWideChar(CP_ACP, 0, p, strlen(p), wp, unicodefilelen);//°Ñ¶Áµ½µÄÎļþת³É¿í×Ö·û
            wp[unicodefilelen] = '\0';
 
            delete[] p;//ÊÍ·ÅÄÚ´æ
            file.Close();
            strBuf = wp;
 
            delete[] wp; 
        } else{ 
            eFileType   = CMBFile::eAutoFileType;
            eFileFormat = CMBFile::eAutoFileFormat;
 
            memBuffer = CMBFile::Load( &file, eFileType, eFileFormat, dwNewSize );
            file.Close( );
         
            pBuffer = static_cast<TCHAR*> (::LocalLock (memBuffer));
           
            _tcscpy_s( strBuf.GetBuffer( dwNewSize ), dwNewSize, pBuffer );
            strBuf.ReleaseBuffer( );
                ::LocalUnlock( memBuffer );
            ::LocalFree( memBuffer );    
        } 
    }
    CATCH_ALL(e)
    {
        file.Close( );
        THROW_LAST ();
        return false;
    }
    END_CATCH_ALL
    return true;
}