Hungarian nomenclature

xiaoxiao2021-03-06  81

Naming Code for MFC, handle, control and structure of Hungarian nomenclature

Windows type

Sample variable

MFC class

Sample variable

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 specification

Prefix

Types of

Example

C

Class or structure

CDocument, CprintInfo

M_

Member variables

m_pdoc, m_ncustomers

?

?

?

Variable naming specification

Prefix

Types of

description

Example

CH

charr

8-bit character

Chgrade

CH

TCHAR

If _unicode definition is 16 characters

Chname

b

Bool

Boolean value

Benable

n

int

Integer (whose size is dependent on the operating system)

NLENGTH

n

Uint

No symbol value (whose size is dependent on the operating system)

NHEight

w

Word

16-bit no sign

WPOS

l

Long

32-bit symbolic integer

Loffset

DW

DWORD

32-bit unsigned integer

DwRange

p

*

pointer

PDOC

LP

Far *

Far pointer

lpszname

LPSZ

LPSTR

32-bit string pointer

lpszname

LPSZ

LPCSTR

32-bit constant string pointer

lpszname

LPSZ

LPCTSTR

If _Unicode definition, 32-bit constant string pointer

lpszname

hide

Handle

Windows object handle

HWnd

lpfn

Callback

Point far pointer to the Callback function

?

Application symbol naming specification

Prefix

Symbol type

Example

range

IDR_

Different types of multiple resource sharing identifies

IDR_MAIINFRAME

1 ~ 0x6FFF

IDD_

Dialog Box Resources IDD_SPELL_CHECK

1 ~ 0x6FFF

HIDD_

Help context of dialog resources

Hidd_spell_check

0x20001 ~ 0x26FF

IDB_

Bitmap resources

IDB_COMPANY_LOGO

1 ~ 0x6FFF

IDC_

Cursor resources

IDC_PENCIL

1 ~ 0x6FFF

IDI_

Icon resource

IDI_NOTEPAD

1 ~ 0x6FFF

ID_

Command from the menu item or toolbar

ID_Tools_Spelling

0x8000 ~ 0xDFFF

HID_

Command Help context

HID_TOOLS_SPELING

0x18000 ~ 0x1DFFF

IDP_

Message box prompt

IDP_INVALID_PARTNO

8 ~ 0xdeef

HIDP_

Message box Help context

HIDP_INVALID_PARTNO

0x30008 ~ 0x3Deff

IDS_

String resources

IDS_COPYRIGHT

1 ~ 0x7eef

IDC_

Controls in the dialog

IDC_Recalc

8 ~ 0xdeef

?

Microsoft MFC Macro Name Specification

name

Types of

_AFXDLL

Unique Dynamic Link Library (DLL) version

_Alpha

Compile only the Dec Alpha processor

_Debug

Including debugging version of diagnosis

_MBCS

Compile multibyte character set

_Unicode

Open Unicode in an application

AFXAPI

Function provided by MFC

Callback

Function by pointer callback

Library identifier nomenclature

Identifier

Value and meaning

U

ANSI (N) or Unicode (U)

di

Debug or release: d = debug; ignore the identifier is issued.

Static library version naming specification

Library

description

NAFXCWD.LIB

Debug version: MFC static connection library

NAFXCW.LIB

Release: MFC Static Library

UAFXCWD.LIB

Debug version: MFC static connection library supported by Unicode

UAFXCW.LIB

Release: MFC static connection library supported by Unicode

Dynamic connection library naming specification

name

Types of

_AFXDLL

Unique Dynamic Connection Library (DLL) version

WinAPI

Functions provided by Windows

?

?

?

?

New naming specification in Windows.h

Types of

Definition description

WinAPI

Using the FAR Pascal location in the API declaration, if you are writing a DLL with an exporting API population point, you can use this type in your own API.

Callback

Location using the FAR Pascal in the application callback routine, such as the window and dialog

LPCSTR

As with LPSTR, only LPCSTR is used to read only string pointers, which defines similar (Const Char Far *)

Uint

The portable non-symbolic integer type, its size is determined by the host environment (for Windows NT and Windows 9x 32); it is synonymous with unsigned int

LRESULT

Window program returns the type of value

Lparam

Declare the type used by LPARAM, LPARAM is the fourth parameter of the window program

WPARAM

Declare the type used by WPARAM, WPARAM is the third parameter of the window program

LPVOID

General pointer type, with (void *), can be used instead of LPSTR

?

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

New Post(0)