-
Notifications
You must be signed in to change notification settings - Fork 12
/
CommonUtils.h
73 lines (60 loc) · 1.57 KB
/
CommonUtils.h
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
#ifndef COMMON_UTILS_H_
#define COMMON_UTILS_H_
LPCTSTR GetRscStr(LPCTSTR lpszSection, DWORD dwID);
LPCTSTR GetRscStr(LPCTSTR lpszSection, LPCTSTR lpszKey);
#define APP_GET_RSCSTR(lpszSection, Index) GetRscStr(lpszSection, Index)
#define SET_DLG_ITEM_TEXT(nID) \
do {\
if (APP_GET_RSCSTR(lpszDlgID, nID) != NULL)\
{\
SetDlgItemText(nID, APP_GET_RSCSTR(lpszDlgID, nID)); \
}\
}while(0);
#define SET_DLG_ITEM_TEXT_EX(nID, lpszSection, nRscID) \
do {\
if (APP_GET_RSCSTR(lpszSection, nRscID) != NULL)\
{\
SetDlgItemText(nID, APP_GET_RSCSTR(lpszSection, nRscID)); \
}\
}while(0);
#define SET_WINDOW_TITLE \
do{\
LPCTSTR lpszTitle = APP_GET_RSCSTR(lpszDlgID, "Title");\
if (lpszTitle != NULL)\
{\
SetWindowText(lpszTitle);\
}\
}while(0);
#define SET_PROPERTYPAGE_TITLE(lpszPageName) \
do {\
static CString strCaption;\
strCaption = APP_GET_RSCSTR(lpszPageName, "Title");\
if (strCaption.GetLength() != 0)\
{\
m_psp.dwFlags |= PSP_USETITLE;\
m_psp.pszTitle = strCaption;\
}\
}while(0);
class CComposedStrings
{
public:
CComposedStrings(LPCTSTR lpszComposedStrings = NULL)
{
m_lpszComposedStrings = lpszComposedStrings;
}
CComposedStrings(DWORD dwStringID)
{
SetComposedStrings(dwStringID);
}
private:
LPCTSTR m_lpszComposedStrings;
CString m_strRscString;
public:
void SetComposedStrings(DWORD dwStringID);
void SetComposedStrings(LPCTSTR lpszComposedStrings);
LPCTSTR GetSubString(int iIndex);
int GetSubStringCount();
};
BOOL Decrypt(BYTE *pbEncryptPSW, LPSTR lpszDecryptPSW);
BOOL Encrypt(BYTE *pbEncryptPSW, LPSTR lpszDecryptPSW);
#endif //COMMON_UTILS_H_