📄 common.h
字号:
////////////////////////////////////////////////////////////////////////////////
// 文件名:Common.h
// 版本号:1.0
// 提交人:杨振龙
// 提交日期:2006.2.13
// 修改人:
// 修改日期:
// 说明:声明了若干个常用功能函数。
////////////////////////////////////////////////////////////////////////////////
#ifndef __COMMON__H__423F1010_8D4D_4aea_BD8E_EB4B32F82C4E
#define __COMMON__H__423F1010_8D4D_4aea_BD8E_EB4B32F82C4E
#include <windows.h>
#ifndef _DLLAPI
#define _DLLAPI extern "C" __declspec(dllimport)
#endif
#define MAX_STRING (int(4096))
#define BnCtrl_GetCheck(hWnd) SendMessage((hWnd), BM_GETCHECK , (WPARAM)0 , (LPARAM)0 )
#define BnCtrl_SetCheck(hWnd) SendMessage((hWnd), BM_SETCHECK , (WPARAM)BST_CHECKED , (LPARAM)0)
#define BnCtrl_SetUnCheck(hWnd) SendMessage((hWnd), BM_SETCHECK , (WPARAM)BST_UNCHECKED, (LPARAM)0)
#define EbCtrl_LimitText(hWnd, n) SendMessage((hWnd), EM_LIMITTEXT , (WPARAM)(n) , (LPARAM)0 )
#define EbCtrl_SetSel(hWnd, St, Ed) SendMessage((hWnd), EM_SETSEL , (WPARAM)(St), (LPARAM)(Ed) )
#define CbCtrl_LimitText(hWnd, n) SendMessage((hWnd), CB_LIMITTEXT , (WPARAM)(n) , (LPARAM)0 )
#define CbCtrl_Clear(hWnd) SendMessage((hWnd), CB_RESETCONTENT, (WPARAM)0 , (LPARAM)0 )
#define CbCtrl_SetEditSel(hWnd, St, Ed) SendMessage((hWnd), CB_SETEDITSEL , (WPARAM)0 , MAKELPARAM((St), (Ed)))
#define CbCtrl_AddAString(hWnd, Str) SendMessage((hWnd), CB_ADDSTRING , (WPARAM)0 , (LPARAM)(Str))
#define CbCtrl_AddStrings(hWnd, StrArry, MaxNum) {for (INT i=0; (NULL != (StrArry)[i]) && (i < (MaxNum)); i++) \
{CbCtrl_AddAString((hWnd), ((StrArry)[i])); \
} \
}
#define CbCtrl_SelectString(hWnd, Str) SendMessage((hWnd), CB_SELECTSTRING, (WPARAM)(-1), (LPARAM)(Str))
#define CbCtrl_SetCurSel(hWnd, i) SendMessage((hWnd), CB_SETCURSEL , (WPARAM)(i) , (LPARAM)0 )
#define CbCtrl_SetCurVal(hWnd, Val, Fm) {TCHAR caBuffer[MAX_NUMS]; \
_sntprintf(caBuffer, MAX_NUMS, (Fm), (Val)); \
CbCtrl_SelectString((hWnd), caBuffer); \
}
#define CbCtrl_GetCurSel(hWnd) SendMessage((hWnd), CB_GETCURSEL , (WPARAM)0 , (LPARAM)0 )
#define CbCtrl_GetCount(hWnd) SendMessage((hWnd), CB_GETCOUNT , (WPARAM)0 , (LPARAM)0 )
#define CbCtrl_GetTextLen(hWnd, ID) SendMessage((hWnd), CB_GETLBTEXTLEN, (WPARAM)(ID), (LPARAM)0 )
#define CbCtrl_GetText(hWnd, ID, Buff) SendMessage((hWnd), CB_GETLBTEXT , (WPARAM)(ID), (LPARAM)(Buff))
#define SpCtrl_SetRange(hWnd, LO, HI) SendMessage((hWnd), UDM_SETRANGE32 , (WPARAM)(LO), (LPARAM)(HI) )
#define SpCtrl_SetPos(hWnd, P) SendMessage((hWnd), UDM_SETPOS , (WPARAM)0 , (LPARAM)MAKELONG((P), 0))
#define SpCtrl_GetPos(hWnd) LOWORD(SendMessage((hWnd), UDM_GETPOS , (WPARAM)0 , (LPARAM)0 ))
_DLLAPI LPTSTR LTrimStr(LPTSTR lpSource);
_DLLAPI LPTSTR RTrimStr(LPTSTR lpSource);
_DLLAPI INT CDECL FMessageBox(
HWND hOwner,
UINT uType,
LPCTSTR lpCaption,
LPCTSTR lpFormat, ...);
_DLLAPI DWORD GetErrorMessage(
LPTSTR lpBuffer,
INT iBufferLength,
DWORD dwErrorCode);
_DLLAPI VOID DecomposeFileName(
LPCTSTR lpFileWholeName,
LPTSTR lpPathBuffer,
LPTSTR lpNameBuffer,
LPTSTR lpExtNameBuffer);
_DLLAPI LPCTSTR CheckFileName(LPCTSTR lpFileName);
_DLLAPI LPCTSTR CheckPathName(LPCTSTR lpPathName);
_DLLAPI INT MakeFileName(
LPTSTR lpBuffer,
LPCTSTR lpPath,
LPCTSTR lpName,
LPCTSTR lpExt);
_DLLAPI BOOL CopyFilesTo(
LPCTSTR lpFileName,
LPCTSTR lpDestPath,
BOOL bFlag);
_DLLAPI BOOL WriteResourceToFile(
LPCTSTR lpFileName,
HMODULE hModule,
LPCTSTR lpResourceName,
LPCTSTR lpResourceType);
_DLLAPI BOOL FileExist(LPCTSTR lpFileName);
_DLLAPI BOOL DirectoryExist(LPCTSTR lpFileName);
_DLLAPI INT GetFilesName(
LPTSTR lpBuffer,
INT iBufferLength,
LPCTSTR lpFileName,
LPCTSTR lpInsert0,
LPCTSTR lpInsert1,
PINT piFiles);
_DLLAPI DWORD GetServiceStatus(
SC_HANDLE hSCManager,
LPCTSTR lpServiceName);
_DLLAPI BOOL StartAService(SC_HANDLE hSCManager, LPCTSTR lpServiceName);
_DLLAPI BOOL StopAService (SC_HANDLE hSCManager, LPCTSTR lpServiceName);
_DLLAPI BOOL InstallAService(
SC_HANDLE hSCManager,
LPCTSTR lpDriverFileName,
LPCTSTR lpServiceName,
LPCTSTR lpDisplayName,
DWORD dwStartType);
_DLLAPI BOOL UninstallAService(
SC_HANDLE hSCManager,
LPCTSTR lpServiceName);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -