现在的位置: 首页 > 综合 > 正文

匈牙利命名法

2013年01月21日 ⁄ 综合 ⁄ 共 3441字 ⁄ 字号 评论关闭

1.通用规则

   <scope_>+<prefix_>+<qualifier>

  scope_              范围前缀

   prefix_               类型前缀

   qualifier            功能描述

 2.  特殊命名

   前缀                           类型                    例子                      解释

   Lm                              class                  LmObject             

   I                                   interface             IUnknown

3.范围前缀

   前缀                            类型                       例子                               解释

   g_                               全局变量                g_Servers

   m_                              成员变量               m_pDoc

   l_                                 局部变量               l_strName                     

4.常用数据类型前缀

   前缀          类型                    内在规格                                                                                                例子

   ch             char                     8-bit character                                                                                      chGrade

   ch             TCHAR               16-bit character if _UNICODE is defined                                         chName

   b                BOOL                 boolean value                                                                                       bEnable

   n                int                        integer (size dependent on operating system)                               nLength

   n                UINT                   unsigned value (size dependent on operating system)                nLength

   w               WORD                16-bit unsigned value                                                                           wPos

   l                 LONG                  32-bit signed integer                                                                            lOffset

   dw             DWORD             32-bit unsigned integer                                                                        dwRange

   p                *                           ambient memory model pointer                                                         pDoc

   lp               FAR*                    far pointer                                                                                               lpDoc

   lpsz           LPSTR                32-bit pointer to character string                                                        lpszName

   lpsz           LPCSTR             32-bit pointer to constant character string                                       lpszName

   lpsz           LPCTSTR           32-bit pointer to constant character string if _UNICODE              lpszName

                                                   is defined                                                           

   h                 handle                handle to windows object                                                                   hWnd

   lpfn             (*fn)()                  callback far pointer to callback function                                            lpfnAbort

5.常用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                        CPaletee*               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

6.visual c++常用宏定义

   前缀            符号类型                                  符号例子                                范围

   IDR_           多个共享的资源                      IDR_MAINFRAME              0x1-0x6fff

   IDD_           对话框资源                              IDD_SPELL_CHECK        0x1-0x6fff

   IDB_           位图资源                                  IDB_COMPANY_LOGO     0x1-0x6fff

   IDC_           光标资源                                  IDC_NOTEPAD                  0x1-0x6fff

   IDI_             图标资源                                  IDI_PENCIL                        0x1-0x6fff

   ID_IDM_    工具或菜单栏                          ID_TOOS_SPELLING       0x8000-0xdfff

   HID_           命令上下文                             HID_TOOLS_SPELLING  0x18000-0x1dfff

   IDP_

          

抱歉!评论已关闭.