[Repost] API parameter specifier prefix detailed

xiaoxiao2021-03-06  68

[Repost] API parameter specifier prefix detailed

This article

AOGO compilation station

http://www.aogosoft.com/ "

Using MASM Write a Windows program, it is actually dealing with the Windows API, and a person is impossible to remember all API usage, so the API reference manual is essential. The API's reference manual is the prototype in the Hungarian representation. The following is the detailed explanation of those prefixes in the API prototype, I hope to help beginners.

Source: Microsoft MSDN Platform SDK Reference

A array array

B Bool (int) Boolean (integer)

By unsigned char (byte) No symbolic characters (bytes)

C char character (byte)

CB Count of bytes bytes

Cr Color Reference Value Color (Reference) Value

CX Count of X (Short) X Collection (Short Integer)

DW DWORD (unsigned long) double word (no symbol length)

f Flags (USUALLY MULTIPLE BIT VALUES) Sign (generally multiple values)

Fn function function

G_ Global Global

H Handle handle

i integer integer

l Long long integer

LP Long Pointer long pointer

M_ Data Member of a Class A class of data members

N Short Int short integer

P P Pointer pointer

String string

SZ ZERO TERMINATED STRING string ends with 0

TM Text Metric Text Rules

u Unsigned int unsigned integer

UL unsigned long (ulong) unsigned long integer

W Word (unsigned short) no symbol short integer

X, Y X, Y Coordinates (Short) Coordinate Value / Short Integer

v void empty

For example, the API function CREATEWINDOWSEX, the API prototype is as follows:

HWND CREATEWINDOWEX

DWORD DWEXSTYLE,

// Extended Window StylelpctStr LpClassName,

// Pointer to Registered Class Name

LPCTSTR LPWINDOWNAME,

// Pointer to Window Name

DWORD DWSTYLE,

// WINDOW STYLE

INT X,

// Horizontal Position of Window

Int Y,

// Vertical Position of Window

Int nwidth,

// WINDOW WIDTH

Int nheight,

// WINDOW HEIGHT

HWND HWNDPARENT,

// Handle to Parent Or Owner Window

Hmenu Hmenu,

// Handle to Menu, Or Child-Window Identifier

Hinstance hinstance,

// Handle to Application Instance

LPVOID LPPARAM

// Pointer to Window-Creation Data

);

Then, according to the above prefix table, DWEXStyle needs a double-word value, lpclassname and lpwindowname need a long pointer to the string (offset address in MASM), X, Y indicates that the integer value is required, NWIDTH and NHEight Indicates that the transmission short integer, hwndparent means that a window handle is required, and the HMENU means that the Hinstance is transmitted, and the LPPARAM represents the program instant (address).

Note You should not see the previous type specifier when you look at the prefix, but you want to look at the prefix, such as DWORD DWEXSTYLE, just look at dwexStyle, know that the double word is passed.

There is also a combination of other combinations, as long as you pay a little attention, such as the LPFN represents a long pointer to the function, is a function of a function in MASM, and is like LPSecurityAttributes, pointing to the Structure_Attributes structure. Pointer (address), LPVBuffer means that the buffer long pointer (LP) is transmitted or empty (Void), and there are some no prefixes, this word is enough to explain it. Wait, familiar with these prefixes allow you to make a quick mastering when you study API. And can eliminate some errors.

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

New Post(0)