匈牙利命名法

匈牙利命名法虽然是C++所使用的,但WIN32ADA与它也紧密关联.

前缀含义a  array                                                      数组bbool(int)                                                布尔byUnsigned char                                         无符号字符(字节)cChar                                                      字符(字节)Cconstant                                                常量cbcount of bytes                                        字节数crColor reference value                                颜色(参考)值cxCount of x (Short)                                   x的集合(短整数)dwDWORD   (unsigned long)                         双字(无符号长整数)fFlags   (usually multiple bit values)               标志(一般是有多位的数值)fnFunction                                                 函数g_global                                                     全局的hHandle                                                   句柄iinteger                                                   整数Llong                                                       长整数lplong pointer                                            长指针m_Data member of a class                             一个类的数据成员nShort int                                                短整数pPointer                                                   指针sString                                                    字符串zs  Zero terminated String                            以0结尾的字符串tmText metric                                            文本规则uiUnsigned int                                           无符号整数ulUnsigned long (ULONG)                           无符号长整数w  WORD (unsigned short)                          无符号短整数x,y  x, y coordinates (short)                          坐标值/短整数v  void                                                     空cclass                                                      类                (CDocument)cstruct                                                    结构体     ( CPrintInfo)

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
VC常用前缀列表:

前缀            类型                 描述                                                                                              例子
ch              char                  8位字符                                                                                          chGrade
ch              TCHAR               16位UNICODE类型字符                                                                     chName
b                BOOL                布尔变量                                                                                         bEnabled
n                int                    整型(其大小由操作系统决定)                                                            nLength
n                UINT                无符号整型(其大小由操作系统决定)                                                   nLength
w               WORD               16位无符号整型                                                                                wPos
l                 LONG                 32位有符号整型                                                                               lOffset
dw             DWORD             32位无符号整型                                                                                dwRange
p                *                        Ambient memory model pointer 内存模块指针,指针变量                      pDoc
lp                FAR*                  长指针                                                                                           lpDoc
lpsz              LPSTR                32位字符串指针                                                                              lpszName
lpsz              LPCSTR              32位常量字符串指针                                                                        lpszName
lpsz              LPCTSTR            32位UNICODE类型常量指针                                                               lpszName
h                 handle                Windows对象句柄                                                                           hWnd
lpfn              (*fn)()       回调函数指针 Callback Far pointer to CALLBACK function                               lpfnAbort

Windows对象名称缩写:

Windows对象       例子变量       MFC类       例子对象

HWND                   hWnd;            CWnd*       pWnd;
HDLG                    hDlg;               CDialog*     pDlg;
HDC                      hDC;               CDC*         pDC;
HGDIOBJ             hGdiObj;         CGdiObject*     pGdiObj;
HPEN     hPen;       CPen*       pPen; 
HBRUSH hBrush;       CBrush*       pBrush; 
HFONT   hFont;       CFont*       pFont; 
HBITMAP       hBitmap;       CBitmap*       pBitmap; 
HPALETTE       hPalette;       CPalette*       pPalette; 
HRGN     hRgn;       CRgn*       pRgn; 
HMENU hMenu;       CMenu*       pMenu; 
HWND    hCtl;       CStatic*       pStatic; 
HWND    hCtl;       CButton*       pBtn;
HWND    hCtl;       CEdit*       pEdit; 
HWND    hCtl;       CListBox*       pListBox;
HWND    hCtl;       CComboBox*       pComboBox;

评论
©Mrack | Powered by LOFTER