Summary of the Hungarian naming law

Source: Internet
Author: User

 

Hungarian naming convention

Naming rules for MFC, handles, controls, and structures

Windows Sample Variables MFC class Sample Variables
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 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 rules

Prefix Type Instance
C Class or structure Cdocument, cprintinfo
M _ Member variables M_pdoc, m_ncustomers

Variable naming rules

Prefix Type Description Instance
Ch Char 8 characters Chgrade
Ch Tchar If_ UnicodeIs 16 characters long. Chname
B Bool Boolean Value Benable
N Int INTEGER (the size depends on the operating system) Nlength
N Uint Unsigned value (its size depends on the operating system) Nheight
W Word 16-bit unsigned Value Wpos
L Long 32-bit signed integer Loffset
DW DWORD 32-bit unsigned integer Dwrange
P * Pointer Pdoc
Lp Far * Remote pointer Lpszname
Lpsz Lpstr 32-Bit String pointer Lpszname
Lpsz Lpcstr 32-bit constant string pointer Lpszname
Lpsz Lpctstr If_ UnicodeIs a 32-bit constant string pointer. Lpszname
H Handle Windows Object handle Hwnd
Lpfn Callback PointCallbackRemote pointer of a function

Application symbol naming rules

Prefix Symbol type Instance Range
Idr _ Multiple Resource Sharing IDs of Different Types Idr_maiinframe 1 ~ 0x6fff
IDD _ Dialog Box Resources Idd_spell_check 1 ~ 0x6fff
Hidd _ Help context of dialog box Resources Hidd_spell_check 0x20001 ~ 0x26ff
Idb _ Bitmap Resources Idb_company_logo 1 ~ 0x6fff
IDC _ Cursor Resource Idc_penpencil 1 ~ 0x6fff
Idi _ Icon Resource Idi_notepad 1 ~ 0x6fff
Id _ Commands from menu items or toolbar Id_tools_spelling 0x8000 ~ 0 xdfff
Hid _ Command help Context Hid_tools_spelling 0x18000 ~ 0x1dfff
IDP _ Message Box prompt Idp_invalid_partno 8 ~ 0 xdeef
Hidp _ Message Box help Context Hidp_invalid_partno 0x30008 ~ 0x3deff
IDS _ String Resource Ids_copyright 1 ~ 0x7eef
IDC _ Controls in the dialog box Idc_recalc 8 ~ 0 xdeef

Microsoft MFC macro naming rules

Name Type
_ Afxdll Unique dynamic connection library (DLL) version
_ Alpha Compile only the DEC Alpha processor
_ Debug Including debugging versions for Diagnosis
_ MBCS Compile multi-byte character sets
_ Unicode Open Unicode in an application
Afxapi Functions provided by MFC
Callback Function called back by pointer

Library identifier name Method

Identifier Value and meaning
U ANSI (n) or Unicode (u)
D Debug or release: D = debug; ignore the identifier as release.

Static library version naming rules

Library Description
Nafxcwd. Lib Debug version: MFC static Connection Library
Nafxcw. Lib Release Version: MFC static Connection Library
Uafxcwd. Lib Debug version: provides a static MFC Connection Library with Unicode support
Uafxcw. Lib Release Version: static Connection Library of MFC with Unicode support

Dynamic Connection Library naming rules

Name Type
_ Afxdll Unique dynamic connection library (DLL) version
Winapi Functions provided by Windows

New naming rules in windows. h

Type Definition description
Winapi Use the far Pascal position in the API declaration. If you are writing a DLL with an export API population, you can use this type in your own API.
Callback The position of the far Pascal used in the application call-back routine, such as the window and dialog box
Lpcstr It is the same as lpstr, but lpcstr is used for read-only string pointers. Its definition is similar to (const char far *)
Uint The portable unsigned integer type. Its size is determined by the host environment (32-bit for Windows NT and Windows 9x). It is a synonym for unsigned Int.
Lresult Type of window program return value
Lparam Declares the type used by lparam. lparam is the fourth parameter of the window program.
Wparam Declares the type used by wparam. wparam is the third parameter of the window program.
Lpvoid The pointer type, which is the same as (void *) and can be used to replace lpstr.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.