📄 common.h
字号:
#ifndef __COMMON_H__
#define __COMMON_H__
#define WideToAnsi(szInput, szOutput, cbOutputSize) WideCharToMultiByte(CP_ACP, \
WC_SEPCHARS, \
szInput, \
-1, \
szOutput, \
cbOutputSize, \
NULL, \
NULL)
#define AnsiToWide(szInput, szOutput, cbOutputSize) MultiByteToWideChar(CP_ACP, \
MB_PRECOMPOSED, \
szInput, \
-1, \
szOutput, \
cbOutputSize)
OLECHAR *AnsiToUnicode(TCHAR *szInput);
OLECHAR *AnsiToUnicode256(TCHAR *szInput);
//AnsiToOlechar will translate an ANSI string to an Unicode string if UNICODE
//is not defined. If UNICODE is defined, the input is assumed to already be in
//Unicode and no translation is performed.
//If you explicitly wish to translate an ANSI string into Unicode regardless
//you can use AnsiToUnicode or AnsiToUnicode256
//
#ifdef UNICODE
#define AnsiToOlechar(x) (x)
#else
#define AnsiToOlechar(x) (AnsiToUnicode256(x))
#endif
enum enumWinVers { enumWin32, enumWin32c, enumWin32s, enumWin16, enumWinxx};
class CAppType
{
private:
enumWinVers WhichWindowsXX(void);
enumWinVers eWindowsVersion;
public:
CAppType() {eWindowsVersion = WhichWindowsXX();}
BOOL IsWindowsNT(void) {return (eWindowsVersion == enumWin32);}
BOOL IsWindows9x(void) {return (eWindowsVersion == enumWin32c);}
BOOL IsWindows32s(void) {return (eWindowsVersion == enumWin32s);}
BOOL IsWindows16(void) {return (eWindowsVersion == enumWin16);}
};
BOOL CenterWindow (HWND hwndChild, HWND hwndParent);
void HResultToString(HRESULT hResult, TCHAR *szErrorString);
void ClsIDToString(IID iid, TCHAR *szErrorString);
BOOL PMOLEMemFree(void *p);
extern HINSTANCE hInstApp;
#ifdef _DEBUG
#ifdef _AFX
#define WS_TRACE0(x) TRACE0(x)
#define WS_TRACE1(x,y) TRACE1(x,y)
#else
#ifdef WIN32
#define TraceDebug0(x) OutputDebugString(x)
void TraceDebug1(LPCTSTR x, LPCTSTR y);
#endif
#define WS_TRACE0(x) TraceDebug0(x)
#define WS_TRACE1(x,y) TraceDebug1(x,y)
#endif //ifdef _AFX
#else //not in debug mode, compiler independent
#define WS_TRACE0(x)
#define WS_TRACE1(x,y)
#endif //ifdef _DEBUG
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -