Small knot "Hungarian Name Law"

zhaozj2021-02-11  178

Hungarian nomenclature

Naming Specification for MFC, handle, control and structure

Windows type sample variable MFC class sample variable HWNDhWnd; CWnd * pWnd; HDLGhDlg; CDialog * pDlg; HDChDC; CDC * pDC; HGDIOBJhGdiObj; CGdiObject * pGdiObj; HPENhPen; CPen * pPen; HBRUSHhBrush; CBrush * pBrush; HFONT hFont; CFont * pFont ; HBITMAP hBitmap; CBitmap * pBitmap; HPALETTE hPaltte; CPalette * pPalette; HRGN hRgn; CRgn * pRgn; hMENU hMenu; CMenu * pMenu; HWND hCtl; CState * pState; HWND hCtl; CButton * pButton; HWND hCtl; CEdit * pEdit; HWND hCtl; CListBox * pListBox; HWND hCtl; CComboBox * pComboBox; HWND hCtl; CScrollBar * pScrollBar; HSZ hszStr; CString pStr; POINT pt; CPoint pt; sIZE size; CSize size; RECT rect; CRect rect;

General prefix naming specification

Prefix type example Class C or structure cDocument, CPrintInFom_ member variable m_pdoc, m_ncustomers

Variable naming specification

Prefix Type Description Instance Chchar8 Bit Character Chgradech Tchar If _unicode definition, 16-bit character chnamebbool Boolean Benablen int integer (whose size depends on operating system) NLENGTHN UINT No symbol value (whose size depends on operating system) NHEighTW Word 16 Non-symbolic WPOSL Long 32-bit Symbol Integer LoffSetDW DWORD 32-bit No Symbol Integer DWRANGEP * Pointer PDOCLP FAR * Far Pointer LPSZNAMELPSZ LPSTR 32 Bit Characters LPSZNAMELPSZ LPCSTR 32-bit Constant string pointer Lpsznamelpsz lpctstr If _unicode definition, The 32-bit constant string pointer lpsznameh handle windows object handle hwndlpfn callback points to the far pointer to the Callback function

Application symbol naming specification

Examples of types of symbols prefixed range IDR_ Help context HIDD_SPELL_CHECK plurality of different types of resource-sharing identification IDR_MAIINFRAME1 ~ 0x6FFFIDD_ dialog resource IDD_SPELL_CHECK 1 ~ 0x6FFFHIDD_ dialog resource 0x20001 ~ 0x26FFIDB_ bitmap resource IDB_COMPANY_LOGO 1 ~ 0x6FFFIDC_ cursor resource IDC_PENCIL 1 ~ 0x6FFFIDI _ icon resource IDI_NOTEPAD 1 ~ 0x6FFFID_ command from the menu or toolbar ID_TOOLS_SPELLING 0x8000 ~ 0xDFFFHID_ command Help context HID_TOOLS_SPELLING 0x18000 ~ 0x1DFFFIDP_ message box prompts IDP_INVALID_PARTNO 8 ~ 0xDEEFHIDP_ message box Help context HIDP_INVALID_PARTNO 0x30008 ~ 0x3DEFFIDS_ string resources IDS_COPYRIGHT 1 ~ 0x7eefidc_ dialog box Control IDC_Recalc 8 ~ 0xdeefmicrosoft MFC Macro Name Specification

Name Type_Afxdll Unique Dynamic Library (DLL) version _alpha only compiles DEC Alpha processors _debug includes the diagnostic debug version _mbCS compile multi-byte character set _Unicode Open UnicodeafxAPI MFC in an application Function of function Callback passes the function of the pointer callback

Library identifier nomenclature

Identifiers and Meaning U ANSI (N) or Unicode (U) D debug or release: d = debug; ignore the identifier is issued.

Static library version naming specification

Description Nafxcwd.lib debug version: MFC Static connection library NAFXCW.LIB Release: MFC Static connection library uafxcwd.lib debug version: MFC static connection library with Unicode support UAFXCW.LIB Release: MFC static connection library supported by Unicode

Dynamic connection library naming specification

Name Type_AFXDLL Unique Dynamic Connection Library (DLL) Version WINAPI Windows Functions Provided

New naming specification in Windows.h

Type Definition Description WinAPI uses the FAR Pascal location in the API declaration, if you are writing a DLL with exporting API people, you can use this type of Callback in your own API to use in the application recursive routine, such as windows and conversations The position LPCSTR of the FAR PASCAL in the frame is the same as LPSTR, just LPCSTR is used for read-only string pointers, which defines similar (const char far *) uint-free integer type, whose size is determined by host environment (for Windows NT and Windows 9x are 32 bits); it is the synonym of unsigned int LRESULT window program Return Value LPARAM declares that the type used by LPARAM, LPARAM is the fourth parameter of the window, WPARAM is used, WPARAM is a window. The third parameter of the program LPVOID general pointer type, with (void *), can be used instead of LPSTR

转载请注明原文地址:https://www.9cbs.com/read-5091.html

New Post(0)