一般情况下,变量的取名方式为:
特殊的类型命名,前缀表示: 类、接口 前缀 类型 例子 备注 表示类型本身 不与范围前缀结合使用 Lm I Class In terface 接口 LmObject IUnknown 注:类名前缀改为Lm,对于非全局的类最好有语义表示其所属模块。类的 实例命名与类名大致相同,只是类名语义表示类的通用含义,而类名表示此实例 的具体语义。如类名LmSketPoi nt 表示草图点的类定义,而它的两个实例 _StartPoi nt,_E ndPoi nt 分别代表起点和终点的语义。类的实例命名带上前缀  。 特殊约定: a. MouseTool的派生类的前缀为_Mt. b .对话框类的前缀为CDlg. c.橡皮条类的前缀为_Rb. 范围前缀: 前缀 类型 全局作用域 成员变量 例子  备注「  g m l g Servers m pDoc, 少用: 局部作用域 l strName 注:编程时尽量少用全局变量,对于全局变量还应在类型前缀后加上如下关 特征模块 : 草图模块 : 装配模块 : 工程图模块: 曲面模块 : Fea Sket Asm Lay Surf Ui 例子 界面模块 常用的一般数据类型的前缀 前缀 类型 内存规格描述 : ch ch b n n w char TCHAR BOOL int UINT WORD 8-bit character 16-bit character if _UNICODE is defi ned Boolea n value In teger (size depe ndent on operat ing system) Un sig ned value (size depe ndent on operat ing system) 16-bit un sig ned value chGrade chName bEn abled nLen gth nLen gth wPos l LONG 32-bit signed in teger lOffset dw P IP Ipsz Ipsz Ipsz DWORD * FAR* LPSTR LPCSTR 32-bit un sig ned in teger Ambie nt memory model poin ter Far poin ter dwRa nge pDoc lpDoc lpszName lpszName lpszName 32-bit poin ter to character stri ng 32-bit poin ter to con sta nt character stri ng LPCTSTR 32-bit poin ter to con sta nt character stri ng if _UNICODE is defi ned han dle (*fn)() Han dle to Win dows object callbackFar poi nter to CALLBACK fun ctio n 对象名称缩写 例子变量 h Ipfn hWnd lpfnAbort 常用Windows Win dows 对 象 MFC类 CWnd * CDialog * CDC* CGdiObject * CPe n * CBrush * CFo nt * CBitmap * CPalette * CRgn * CMe nu * CStatic * CButton * CEdit * CListBox * CComboBox * 符号例子 例子对象 HWND HDLG HDC HGDIOBJ HPEN HBRUSH HFONT HBITMAP HPALETTE HRGN HMENU HWND HWND HWND HWND  HWND hWnd ; hDlg ; hDC ; hGdiObj ; hPen ; hBrush ; hFont ; hBitmap ; hPalette ; hRgn ; hMe nu ; hCtl ; hCtl ; hCtl ; hCtl ; hCtl ; 常用宏定义命名列表 符号类型 标识多个资源共享 的类型 对话框资源 pWnd ; pDlg ; pDC ; pGdiObj ; pPe n ; pBrush ; pFont ; pBitmap ; pPalette ; pRgn ; pMe nu ; pStatic ; pBt n ; pEdit ; pListBox ; pComboBox ; 范围 Visual C++ 前缀 IDR_ IDD_ IDB_ IDC IDI  ID IDM IDR_MAINFRAME IDD_SPELL_CHECK IDB_COMPANY_LOGO IDC PENCIL IDI NOTEPAD ID TOOLS SPELLING 1 to 0x6FFF 1 to 0x6FFF 1 to 0x6FFF 1 to 0x6FFF 1 to 0x6FFF 0x8000 to (Dialog) 位图资源 (Bitmap) 光标资源(Cursor) 图标资源(Icon) 工具栏或采单栏的 命令项 OxDFFF HID_TOOLS_SPELLING 0x18000 to 0x1DFFF 8 to 0xDFFF 0x30008 to 0x3DFFF 1 to 0x7FFF 8 to 0xDFFF HID_ 命令上下文帮助 (Comma nd Help con text) IDP_ HIDP_ 消息框提示文字资 源 消息框上下文帮助 IDP_INVALID_PARTNO HIDP_INVALID_PARTNO (Message-box Help con text) IDS_ IDC_ VISUAL C++ 类型 字符串资源 IDS_COPYRIGHT IDC_RECALC (Stri ng) 对话框内的控制资 源(Co ntrol) 下的数据类型 含义 ATOM Atom. For more in formatio n, see Atoms. BOOL BOOLEAN BYTE CALLBACK CHAR Boolea n variable (should be TRUE or FALSE). Boolea n variable (should be TRUE or FALSE). Byte (8 bits). Calli ng conven tio n for callback fun cti ons. 8-bit Win dows (ANSI) character. For more in formatio n, see Character Sets Used By Fon ts. Red, gree n, blue (RGB) color value (32 bits). See COLORREF for information on this type. Variable whose value is to rema in con sta nt duri ng executi on. 32-bit un sig ned in teger. COLORREF CONST DWORD DWORD_PTR Un sig ned long type for poin ter precisi on. Use whe n casti ng a poin ter to a long type to perform poin ter arithmetic. (Also com monly used for gen eral 32-bit parameters that have bee n extended to  bits in -bit Win dows.) DWORD32 DWORD 32-bit un sig ned in teger. -bit unsigned in teger. FLOAT HACCEL HANDLE HBITMAP HBRUSH HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HIMAGELIST HIMC HINSTANCE HKEY HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRGN HRSRC HSZ HWINSTA  HWND Float in g-po int variable. Han die to an accelerator table. Handle to an object. Han dle to a bitmap. Han dle to a brush. Han dle to a dyn amic data excha nge (DDE) con versati on. Han dle to a DDE conv ersatio n list. Han dle to a cursor. Han dle to a device con text (DC). Han dle to DDE data. Han dle to a desktop. Han dle to an internal drop structure. Han dle to a deferred win dow positi on structure. Han dle to an enhan ced metafile. Han dle to a file ope ned by OpenFile , not CreateFile . Han dle to a font. Han dle to a GDI object. Han dle to a global memory block. Han dle to a hook. Han dle to an icon. Han dle to an image list. Han dle to in put con text. Han dle to an in sta nee. Han dle to a registry key. In put locale ide ntifier. Han dle to a local memory block. Han dle to a menu. Han dle to a metafile. Han dle to a module. The value is the base address of the module. Han dle to a display mon itor. Han dle to a palette. Han dle to a pen. Han dle to a region. Han dle to a resource. Han dle to a DDE stri ng. Han dle to a wi ndow stati on. Han dle to a win dow. INT INT_PTR 32-bit sig ned in teger. Sig ned in tegral type for pointer precisi on. Use whe n casti ng a poin ter to an in teger to perform poin ter arithmetic. 32-bit sig ned in teger. -bit sig ned in teger. Lan guage ide ntifier. For more in formati on, see Locales. Locale ide ntifier. For more in formati on, see Locales. Locale in formati on type. For a list, see Locale and Lan guage In formati on. INT32 INT LANGID LCID LCTYPE LONG  LONG_PTR 32-bit sig ned in teger. Sig ned long type for poi nter precisi on. Use whe n casti ng a poin ter to a long to perform poin ter arithmetic. 32-bit sig ned in teger. -bit sig ned in teger. -bit sig ned in teger. Message parameter. Pointer to a BOOL . Pointer to a BYTE . Poi nter to a COLORREF value. Poi nter to a CRITICAL SECTION . Poin ter to a con sta nt null-terminated string of 8-bit Win dows (ANSI) characters. For more in formati on, see Character Sets Used By Fonts. An LPCWSTR if UNICODE is defin ed, an LPCTSTR otherwise. Poin ter to a con sta nt of any type. Poin ter to a con sta nt null-terminated string of 16-bit Uni code characters. For more in formati on, see Character Sets Used By Fon ts. LONG32 LONG LONGLONG LPARAM LPBOOL LPBYTE LPCOLORREF LPCRITICAL_SECTION  LPCSTR  LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE Pointer to a DWORD . Poi nter to a HANDLE . LPINT LPLONG LPSTR Pointer to an INT . Pointer to a LONG . Pointer to a null-terminated string of 8-bit Win dows (ANSI) characters. For more in formatio n, see Character Sets Used By Fon ts. An LPWSTR if UNICODE is defined, an LPSTR otherwise. Poin ter to any type. Pointer to a WORD . Poi nter to a n ull-termi nated stri ng of 16-bit Uni code characters. For more in formati on, see Character Sets Used By Fonts. LPTSTR LPVOID LPWORD  LPWSTR  LRESULT Signed result of message process ing. LUID PBOOL PBOOLEAN PBYTE PCHAR PCRITICAL_SECTION  PCSTR Locally unique ide ntifier. Pointer to a BOOL . Pointer to a BOOL . Pointer to a BYTE . Pointer to a CHAR . Poi nter to a CRITICAL SECTION Poin ter to a con sta nt null-terminated string of 8-bit Win dows (ANSI) characters. For more in formati on, see Character Sets Used By Fonts. A PCWSTR if UNICODE is defi ned, a PCSTR otherwise. Pointer to a constant WCHAR . Poin ter to a con sta nt null-terminated string of 16-bit Uni code characters. For more in formati on, see Character Sets Used By Fon ts. Poi nter to a DWORD . Poi nter to a FLOAT . Poi nter to a HANDLE . Poin ter to an HKEY . Poin ter to an INT . Poin ter to an LCID . Poi nter to a LONG .  PCTSTR PCWCH  PCWSTR PDWORD PFLOAT PHANDLE PHKEY PINT PLCID  PLONG PLUID POINTER_32 Pointer to a LUID . 32-bit pointer. On a 32-bit system, this is a n ative poin ter. On a -bit system, this is a trun cated -bit poin ter. POINTER_ -bit pointer. On a -bit system, this is a n ative poin ter. On a 32-bit system, this is a sig n-exte nded 32-bit poin ter. Pointer to a SHORT . Pointer to a null-terminated string of 8-bit Win dows (ANSI) characters. For more in formatio n, see Character Sets Used By Fon ts. Pointer to a TBYTE . Pointer to a TCHAR . PWSTR if UNICODE is defi ned, a PSTR otherwise. Pointer to a TBYTE . Pointer to a TCHAR . A PWSTR if UNICODE is defined, a PSTR otherwise. Pointer to a UCHAR . Pointer to a UINT . Pointer to a ULONG . Pointer to a USHORT . Poin ter to any type. Pointer to a WCHAR . Pointer to a WORD . Pointer to a null-terminated string of 16-bit Uni code characters. For more in formati on, see Character Sets Used By Fonts. REGSAM SC_HANDLE Security access mask for registry key. Han dle to a service con trol man ager database. For more in formati on, see SCM Han dles. Han dle to a service con trol man ager database lock. For more in formati on, see SCM Han dles. Han dle to a service status value. For more in formati on, see SCM PSHORT PSTR PTBYTE PTCHAR PTSTR PTBYTE PTCHAR PTSTR PUCHAR PUINT PULONG PUSHORT PVOID PWCHAR PWORD PWSTR SC_LOCK  SERVICE_STATUS_HANDLE _ SHORT SIZE_T Han dies. Short in teger (16 bits). The maximum nu mber of bytes to which a poin ter can point. Use for a count that must spa n the full range of a poin ter. SSIZE T TBYTE TCHAR UCHAR UINT UINT PTR UINT32 UINT ULONG ULONG PTR ULONG32 ULONG ULONGLONG UNSIGNED USHORT VOID WCHAR Signed SIZE T . A WCHAR if UNICODE is defi ned, a CHAR otherwise. A WCHAR if UNICODE is defi ned, a CHAR otherwise. Un sig ned CHAR . Un sig ned INT . Un sig ned INT PTR . Un sig ned INT32 . Un sig ned INT . Un sig ned LONG . Un sig ned LONG PTR . Un sig ned LONG32 . Un sig ned LONG . -bit un sig ned in teger. Un sig ned attribute. Un sig ned SHORT . Any type. 16-bit Uni code character. For more in formati on, see Character Sets Used By Fonts. Calli ng conven ti on for system fun cti ons. 16-bit unsigned integer. Message parameter. WINAPI WORD WPARAM               
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- 91gzw.com 版权所有 湘ICP备2023023988号-2
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务