-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLocalizeRC.cpp
More file actions
109 lines (79 loc) · 2.47 KB
/
LocalizeRC.cpp
File metadata and controls
109 lines (79 loc) · 2.47 KB
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
// LocalizeRC.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "resource.h"
#include "IniEx.h"
#include "LocalizeRC.h"
#include "LocalizeRCDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CLocalizeRCApp
BEGIN_MESSAGE_MAP(CLocalizeRCApp, CWinApp)
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
// CLocalizeRCApp construction
CLocalizeRCApp::CLocalizeRCApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
// The one and only CLocalizeRCApp object
CLocalizeRCApp theApp;
// CLocalizeRCApp initialization
BOOL CLocalizeRCApp::InitInstance()
{
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
InitCommonControls();
//AfxEnableControlContainer(); no ActiveX support
AfxInitRichEdit();
CWinApp::InitInstance();
SetRegistryKey(_T("LocalizeRC"));
CurLangID = STANDARD_LANGID;
if( !LoadLangIDDLL( static_cast<LANGID>( GetProfileInt( SEC_LASTPROJECT, ENT_LANGID, 0 ) )) )
if( !LoadLangIDDLL(GetUserDefaultLangID()) )
LoadLangIDDLL(GetSystemDefaultLangID());
CString strWorkspace(_T(""));
LPTSTR szCommandLine = ::GetCommandLineW();
int argc = 0;
LPWSTR * argv = ::CommandLineToArgvW(szCommandLine, &argc);
if(argc > 1)
strWorkspace = argv[1];
CLocalizeRCDlg dlg(strWorkspace);
dlg.LangID = CurLangID;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
if( CurLangID != STANDARD_LANGID )
FreeLibrary( AfxGetResourceHandle() );
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
BOOL CLocalizeRCApp::LoadLangIDDLL(LANGID LangID)
{
HINSTANCE hInstance;
CString strLangIDDLL;
if( LangID == STANDARD_LANGID ) // integrated language is the right one
return true;
strLangIDDLL.Format( _T("LocalizeRC%.2x.dll"), LangID );
hInstance = LoadLibrary( strLangIDDLL );
if( hInstance )
{
AfxSetResourceHandle( hInstance );
CurLangID = LangID;
return true;
}
return false;
}