Basic vbprogramming courses
What is API text browser?
API functions declare data types and "type security"
Regular number Structure
Small API function sets: Controls and message functions, hardware and system functions, menu functions, and drawing functions
What is API
First, it is necessary to explain to you what APIs are. The so-called API was originally written for C and C ++ programmers. An API is a function that is included in a dynamic connection library file attached with a DLL name. In terms of standard definition, APIs are Windows 32-bit application programming interfaces and are a series of complex functions, messages, and structures, it allows programmers to compile applications running on Windows 95 and Windows NT operating systems in different programming languages. It can be said that if you have learned VC before, then the API is not a problem for you. However, if you have never learned VC or are not familiar with the Windows 95 architecture, it is very hard to learn API.
If you open the windows system folder, you can find many files with the name DLL attached to them. A dll contains more than one API function, dozens, or even hundreds. Can we all master it? The answer is no: it is impossible to grasp. But in fact, we really don't have to master it all. We only need to master the built-in API functions of the ipvs system. However, you should also discard functions that are repeated with the functions of VB itself. For example, VB
The etAttr command of can get the file attributes, and SetAttr can set the file attributes. There are also corresponding functions for the API.
GetFileAttributes and SetFileAttributes have similar performance. In this case, there are 5 and 600 remaining items. Yes, there are also many. However, I can tell you that as long as you are familiar with 100, your programming level is at least twice higher than today. Although VB is closely related to WINDOWS, I think the API is closer
WINDOWS. If you have learned the API, your first achievement is your understanding of the WINDOWS architecture. This harvest is not easy.
What if you don't rely on APIs? I can tell you that most of them are advanced programming books (of course, this is not the name of a book, rather, in the first book content, the book reads those books whose objects are readers with a certain VB basis. The first question raised is generally from API. Therefore, if you do not learn APIs, you will probably stay at the initial level and cannot climb up. The only way may be to ask someone for help: I am dying. Come and help me. What should I do? Bored? Of course, there are too many good people on the Internet (including me), but you should understand that through this channel, you cannot produce good works in your hands. This is because your mind lacks this knowledge. Reagan cannot be an overall design concept.
API text explorer [Return]
Many API functions are very long and long. What do you want to see? The following is an example of the API DdeClientTransaction function:
Declare Function DdeClientTransaction Lib "user32" (pData As Byte, ByVal cbData As Long, ByVal hConv As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal wType As Long, byVal dwTimeout As Long, pdwResult As Long) As Long
Wow! So long? If you have never been familiar with APIs, I think you will be scared. You may consider whether to continue learning. But don't worry. Fortunately, Microsoft designers provide us with useful tools. This is the API
Text viewer.
Through the API text viewer, we can easily find the function declaration, structure type, and constant required by the program, copy it to the clipboard, and then paste it into the code segment of the VB program. In most cases, as long as we determine the functions, structures, and constants required by the program, you can add them to the program segment through the above operations on the API text browser, so that these functions can be used in the program. These are the most basic common sense questions for learning APIs, and they do not occupy the huge system content of APIs. Where will we waste our energy in the future? That is:
When to use what function, when to use what structure type, and when to use what constant.
API function declaration
Let's look back. In VB, how do I declare functions? I think if you are reading this article, you will be able to answer this question. The following is the function declaration you should be familiar:
Function SetFocus (ByVal hwnd As Long) As Long
That is, this line of code defines a function named SetFocus. This function has a Long data type parameter and is passed by value (ByVal). After the function is executed, a Long data is returned.
The declaration of API functions is similar. For example, the SetFocus function in API is written as follows:
Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
A little complicated. Yes, it's complicated. But I can tell you that the other parts are the same as what you learned before. The same is true for function calls in programs. For example:
Dim dl As Long
Dl & = SetFoucs (Form1.Hwnd)
However, it is clear. It does not show the running mechanism as you write your own program, nor does it look like VB
The built-in functions can be found from the online help of VB. The only method is to learn and query information other than VB.
The Declare statement is used to Declare references to external processes in the dynamic link library (DLL) at the module level. You only need to remember that this statement is required for any API function declaration.
Iib indicates the dynamic link library or code resource that contains the declared process or function. That is to say, it indicates the question of where a function or process comes from.
In the preceding example, SetFocus Lib "user32" indicates that the SetFocus function is from the user32.dll file. The main dll dynamic connection library files include:
User32.dll for Windows Management. User interfaces for generating and managing applications.
GDI32.dll graphical device interface. Generate graphical output for Windows devices
Kernel32.dll system service. Access the computer resources of the operating system.
Note: When the DLL file is not in the Windows or System folder, you must describe its source in the function (
Path ). For example, SetFocus Lib "c: \ Mydll \ user32"
Alias in function declaration is optional. Indicates that the called process has another name (alias) in the dynamic link library (DLL ). For example, Alias "SetFocus" indicates that another name of the SetFocus function in User32.dll is,
SetFocus. Why are the two names the same? Of course, it can also be different. In many cases, the function name specified by Alias, that is, the last character of the Alias is often Character A. For example, another name of the SetWindowsText function is
SetWindowsTextA, Which is Alias "SetWindowsTextA ". This A is just A naming convention used by designers to indicate that the function belongs to the ANSI version.
So what is the purpose of an alias? Theoretically, an alias provides a function method to call an API with another name. If you specify an alias, though we call this function based on the function following the Declare statement, the alias is the first choice in actual function calling. For example, the following two functions (Function, ABCD) are valid and they call the same SetFocus Function:
Declare Function SetFocus Lib "user32" "SetFocus" (ByVal hwnd As Long) As Long
Declare ABCD SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Note that when using Alias, you should pay attention to the Case sensitivity of the Alias. If you do not use Alias, the function name must be case sensitive and cannot be changed. Of course, in many cases, the function declaration is directly from the API
Because this error is copied from the text browser, there are very few opportunities for such errors, but you need to know this.
Finally, we remind you that the API Declaration (including the structure and constant) must be placed in the "General Declarations" section of the form or module.
Data Type and "type security"
The data types used in API functions are basically the same as those in VB. However, an Integer does not exist in the WIN32 API function.
Data type. In addition, the Boolean data type cannot be seen in API functions. Variant Data types appear in the form of Any in API functions, such As Data As Any. Although its meaning is to allow any parameter type to be passed as a parameter of this API function, this method has some disadvantages. The reason is that this will disable all type checks for the target parameter. This will naturally lead to errors for various types of parameter calls.
To enforce strict type checks and avoid the problems mentioned above, one way is to use the Alias technology mentioned above in functions. For example, you can declare the API function GetDIBits. As follows:
Prototype of the GetDIBits function:
Public Declare Function GetDIBits Lib "gdi32" Alias "GetDIBits" (ByVal aHDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long
Transformation of the GetDIBits function:
Public Declare Function GetDIBitsLong Lib "gdi32" Alias "GetDIBits" (ByVal aHDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Long, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long
Based on the previous knowledge in this course, we can know whether the prototype GetDIBits function or the GetDIBitsLong function is modified. Actually, the original GetDIBits function specified by Alias will be called. However, you should see that the difference between the two is that we force the lpBits parameter to be set to Long in the transformed function. This will minimize the chance of errors in function calls. This method is called the "Security type" statement.
Data Types often seen in API functions include Long, String, Byte, Any... (that's all .)
Constant
There is nothing special about API constants. See the following code in VB:
Msg = MsgBox ("hello", vbOKCancel)
We know that the value of the constant vbOKCancel is equal to 1. The above code can be written in this way without affecting the functions of the Code:
Msg = MsgBox ("hello", 1)
But you probably don't want to choose the next one, because it will make it hard to understand the code. This method is also adopted by the API. However, the API constant must be initialized before the event. VB itself cannot be understood. Its content still comes from
Text browser. The specific form is as follows:
Public Const ABM_ACTIVATE = & H6
Public Const RIGHT_CTRL_PRESSED = & H4
Public Const RPC_E_SERVER_DIED = & H80010007
Private Const RPC_S_CALL_FAILED_DNE = 1727 &
In constant initialization, some programs use Global, such as Global Const ABM_ACTIVATE = & H6, But I think Public can replace it completely. I used Global in the past, but it is not very useful now. I will use this for a while, and I will use it for a while. The consistency between various programs cannot be maintained. At least it looks awkward.
Structure [Return]
The structure is the statement in C and C ++ languages. In VB, it is generally called a custom data type. Presumably many of my friends already know it. In the API field, I prefer to call it a structure because the various API structure types are not defined by me (
.
In VB, the API structure is also defined by the TYPE... end type statement. For example, in an API, the Point structure is defined as follows:
Public Type POINTAPI
Coordinate value of X As Long at X coordinate (X coordinate)
Y As Long 'coordinate value at Y coordinate (Y coordinate)
End Type
For example, the Rect structure in API is defined as follows:
Public Type RECT
Left As Long 'x coordinate in the upper Left corner of the rectangle
Top As Long 'y coordinate in the upper left corner of the rectangle
Right As Long 'x coordinate in the lower Right corner of the rectangle
Bottom As Long 'y coordinate at the Bottom right corner of the rectangle
End Type
These contents can also be copied from the API text browser. The variable names in these structures can be modified without affecting the structure itself. That is to say, these member variables are all virtual. For example, the POINTAPI structure can be changed to the following:
Public Type POINTAPI
The coordinate value of MyX As Long at the X coordinate (abscissa ).
The coordinate value of MyY As Long at Y coordinate (Y coordinate ).
End Type
However, in general, this is not necessary. The structure itself is a data type. Therefore, you must declare the specific variable as the structure type in use to truly use the structure in the program. The structure declaration method is the same as other data declaration methods. For example, the following statement declares the change MyPoint as the POINTAPI structure type:
MyPoint As POINTAPI
It is also very simple to reference the member variables in the structure. Add a "." After the structure name, and then write the member variables to be referenced. This is like referencing a property of an object in VB. For example, if we assign the value of the X variable in the MyPoint structure declared above to the variable Temp &
The Code is as follows:
Temp & = MyPoint. X
However, you should never think that the MyPoint in the above example is a value. It is not a value, but an address (
Pointer ). Value and address are completely different concepts. The structure must be passed to WINDOWS functions by reference, that is, all APIs
In the function, the structure is passed by ByRef (in the Declare statement, ByRef is the default type ). Do not try to use ByVal for Structure Transfer. You will get nothing. Because the structure name is actually a pointer to this structure (the first address of this structure), you can transmit a specific structure name (see the Summary, I highlighted this transfer method in red ).
Since the structure transmits a pointer, the function will directly perform read and write operations on the structure. This feature is suitable for loading the results of function execution in the structure.
Small knot [Return]
The following procedures are provided to summarize the content learned in this lesson. Start VB, create a project, add a command button, copy the following code to the code snippet, and run it.
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI 'defines the Point structure
Coordinate value of X As Long at X coordinate (X coordinate)
Y As Long 'coordinate value at Y coordinate (Y coordinate)
End Type
Sub PrintCursorPos ()
Dim dl AS Long
Dim MyPoint As POINTAPI
Dl & = GetCursorPos (MyPoint) 'calls the function to obtain the mouse coordinates on the screen.
Debug. Print "X =" & Str (MyPoint. X) & "and" & "Y =" & Str (MyPoint. Y)
End Sub
Private Sub commandementclick ()
PrintCursorPos
End Sub
Output result:
X = 240 and Y = 151
In the program, the GetCursorPos function is used to obtain the position of the mouse pointer on the screen.
In the above example, you can find that the content of the MyPpint structure passed by the parameter changes substantially after the function call. This is because the structure is passed by ByRef.
Some API function sets [Return]
Windows API
1. Controls and message Functions
AdjustWindowRect specifies a window style and calculates the size of the window required to obtain the rectangle of the target customer area.
AnyPopup determines whether any pop-up window exists on the screen
ArrangeIconicWindows arranges a minimum child window of a parent window
AttachThreadInput connection thread Input Function
BeginDeferWindowPos starts the process of building a series of new window positions
BringWindowToTop: Bring the specified window to the top of the window list
CascadeWindows arrange windows in cascade Mode
ChildWindowFromPoint: The returned parent window contains the handle of the first child window of the specified vertex.
ClientToScreen: determines the screen coordinates of a point represented by client zone coordinates in the window.
CloseWindow minimizes the specified window
Copy CopyRect rectangular content
DeferWindowPos this function specifies a new window location for a specific window
DestroyWindow clears the specified window and all its subwindows.
DrawAnimatedRects depicts a series of dynamic rectangles
EnableWindow: Allows or disables all mouse and keyboard input in the window specified by EnableWindow.
EndDeferWindowPos simultaneously updates the location and status of all windows specified during DeferWindowPos calling.
EnumChildWindows: Specifies the parent window to enumerate child windows.
EnumThreadWindows enumeration window related to a specified task
All parent windows in the EnumWindows enumeration window list
Duplicate rect to determine whether the two rectangles have the same structure
FindWindow: Find the first top-level window in the window list that meets the specified conditions.
In the window list, find the first child window that matches the specified condition.
Flash window flashes to display the specified window
GetActiveWindow: Get the handle of the activity window
GetCapture obtains the handle of a window, which is located in the current input thread and has Mouse capture (received by the mouse activity)
GetClassInfo obtains a copy of The WNDCLASS structure (or WNDCLASSEX structure). The structure contains information related to the specified class.
GetClassLong gets a Long variable entry of the window class.
GetClassName: Get the class name for the specified window
GetClassWord obtains an integer variable for the window class.
GetClientRect returns the size of the rectangle in the specified window.
GetDesktopWindow: Get a window (desktop window) handle representing the entire Screen
GetFocus: Get the handle of the window with the input focus
GetForegroundWindow
GetLastActivePopup obtains the handle of the recently activated pop-up window in a given parent window.
GetLastError is used to obtain the extended error message for the previously called api function.
GetParent determines the parent window of a specified window
GetTopWindow searches for the internal window list and finds the handle of the first window of the specified window.
GetUpdateRect obtains a rectangle that describes the part of the specified window to be updated.
GetWindow obtains the handle of a window, which has a specific relationship with a source window.
GetWindowContextHelpId gets the help scenario ID associated with the window
GetWindowLong obtains information from the structure of the specified window.
GetWindowPlacement
GetWindowRect obtains the range rectangle of the entire window. The border, title bar, scroll bar, and menu of the window are all in this rectangle.
GetWindowText gets the title text of a form, or the content of a control.
GetWindowTextLength investigate the length of text or control content in the window title
GetWindowWord obtains information about the specified window structure.
InflateRect increases or decreases the size of a rectangle.
The IntersectRect function loads a rectangle in lpDestRect, which is the intersection of the two rectangles lpSrc1Rect and lpSrc2Rect.
InvalidateRect shields all or part of a window's customer Zone
IsChild checks whether a window is a child or subordinate window of another window.
IsIconic determines whether the window has been minimized
IsRectEmpty checks whether a rectangle is empty
IsWindow: determines whether a window handle is valid
IsWindowEnabled: checks whether the window is active.
IsWindowUnicode checks whether a window is a Unicode window. This means that the window receives Unicode text for all text-based messages.
IsWindowVisible: determines whether the window is visible
IsZoomed determines whether the window is maximized
LockWindowUpdate: locks the specified window and disables update.
MapWindowPoints converts the coordinates of the customer zone in one window to the coordinate system of the customer zone in the other window.
MoveWindow changes the position and size of the specified window
OffsetRect moves the rectangle by applying a specified offset.
OpenIcon restores a minimal program and activates it.
PtInRect: determines whether the specified vertex is inside the rectangle.
RedrawWindow redraw all or part of the window
ReleaseCapture: Release Mouse capture for the current application
ScreenToClient determines the customer zone coordinates of a specified point on the screen
All or part of the client area of the ScrollWindow rolling window
Scrollintowex scroll all or part of the customer area of the window according to the additional options
SetActiveWindow activates the specified window
SetCapture: Set the Mouse capture to the specified window
SetClassLong sets a Long variable entry for the window class
SetClassWord: Set an entry for the window class
SetFocusAPI sets the input focus to the specified window. The window will be activated if necessary
SetForegroundWindow: Set the window to the foreground window of the system.
SetParent specifies the new parent of a window
SetRect: Set the content of the specified rectangle
SetRectEmpty: Set the rectangle to an empty rectangle.
SetWindowContextHelpId sets the help scenario (context) ID for the specified window
SetWindowLong sets the information for the specified window in the window structure.
SetWindowPlacement
SetWindowPos specifies a new position and status for the window
SetWindowText: Set the title text or control content of the window
SetWindowWord specifies window settings in the window structure.
ShowOwnedPopups: display or hide all pop-up windows owned by the specified window
ShowWindow control window visibility
ShowWindowAsync is similar to ShowWindow
SubtractRect loads the rectangular lprcDst, which is the result of subtracting lprcSrc2 from the rectangular lprcSrc1.
TileWindows arrange windows in Tiled order
UnionRect loads an lpDestRect target rectangle, which is the result of the combination of lpSrc1Rect and lpSrc2Rect.
UpdateWindow force update window
All or part of the ValidateRect validation window
WindowFromPoint returns the handle of the window containing the specified vertex. Ignore shielding, hiding, and transparent windows
2. Hardware and system functions
ActivateKeyboardLayout activates a new keyboard layout. The keyboard layout defines the position and meaning of keys on a physical keyboard.
Beep is used to generate simple sound
CharToOem converts a string from the ANSI character set to the OEM Character Set
ClipCursor limits the pointer to a specified area
Convertdefalocallocale converts a special local identifier to a real local ID.
CreateCaret creates an insert operator (cursor) based on the specified information and selects it as the default insert operator of the specified window.
DestroyCaret clears (destroys) an insert Operator
EnumCalendarInfo enumeration of calendar information available in the specified "local" Environment
EnumDateFormats lists available long and short date formats in the specified "local" Settings
Code Page installed or supported in the EnumSystemCodePages enumeration system
The EnumSystemLocales enumeration system has been installed or supports "local" settings.
EnumTimeFormats enumerates the time format applicable to a specified place
ExitWindowsEx exits windows and restarts with specific options
ExpandEnvironmentStrings expanded environment string
FreeEnvironmentStrings: Translation of specified environment string Blocks
GetACP identifies the ANSI code page currently in effect
GetAsyncKeyState determines the status of the specified virtual key when the function is called
GetCaretBlinkTime determines the blinking frequency of the insert operator cursor
GetCaretPos
GetClipCursor obtains a rectangle to describe the cut area currently specified by the mouse pointer.
GetCommandLine gets a pointer to the current command line buffer
GetComputerName: Get the name of this computer
GetCPInfo obtains information related to the specified code page.
GetCurrencyFormat is used to format a number based on the currency format.
GetCursor obtains the handle of the currently selected mouse pointer
GetCursorPos: Get the current cursor position
GetDateFormat format a system date for the specified "local" Format
GetDoubleClickTime determines the interval between two consecutive mouse clicks that will be processed as a double-click event
GetEnvironmentStrings is a memory block that contains the current environment string settings and returns a handle.
GetEnvironmentVariable obtains the value of an environment variable.
GetInputState determines whether there are any pending mouse or Keyboard Events
GetKBCodePage is replaced by GetOEMCP, which has the same functions.
GetKeyboardLayout gets a handle that describes the keyboard layout of the specified application.
GetKeyboardLayoutList to obtain a list of all keyboard layouts applicable to the System
GetKeyboardLayoutName gets the name of the current active keyboard layout
GetKeyboardState: obtains the current status of each virtual key on the keyboard.
GetKeyboardType for information about the keyboard in use
GetKeyNameText determines the key name based on the scan code.
GetKeyState determines the status of the specified virtual key when you input the last time for processed buttons.
GetLastError is used to obtain the extended error message for the previously called api function.
GetLocaleInfo obtains information related to the specified "location ".
GetLocalTime get local Date and Time
GetNumberFormat format a number in a specific format for a specified "location ".
GetOEMCP identifies the windows code page that is converted between the OEM and ANSI character sets
GetQueueStatus determines the type of the message to be determined (waiting for processing) in the application Message Queue
GetSysColor determines the color of the specified windows Display object
GetSystemDefaultLangID obtains the default language ID of the system.
GetSystemDefaultLCID gets the current default system "local"
GetSystemInfo obtains information about the underlying hardware platform.
GetSystemMetrics returns information related to the windows Environment
GetSystemPowerStatus obtains information about the current system power status.
GetSystemTime gets the current system time, which is in the coordinated world Time (UTC, also known as GMT) format.
GetSystemTimeAdjustment synchronizes the internal system clock with an external clock signal source
GetThreadLocale gets the local ID of the current thread
GetTickCount is used to obtain the length of time (MS) that has elapsed since windows was started)
GetTimeFormat format a system time according to a specific format for the specified "location"
GetTimeZoneInformation obtains information related to system time zone settings.
GetUserDefaultLangID is the default language ID obtained by the current user.
GetUserDefaultLCID gets the default "local" setting of the current user
GetUserName: get the name of the current user
GetVersion: determine the current Windows and DOS versions.
GetVersionEx obtains version information related to the platform and operating system.
HideCaret hides the insert operator (cursor) in the specified window)
IsValidCodePage determines whether a code page is valid
IsValidLocale determines whether the local ID is valid
The keybd_event function simulates keyboard operations.
LoadKeyboardLayout load a keyboard layout
MapVirtualKey performs different scan codes and character Conversion Based on the specified ing type
MapVirtualKeyEx performs different scan codes and character Conversion Based on the specified ing type
MessageBeep plays a system sound. The system sound distribution scheme is determined in the control panel.
Mouse_event simulates a mouse event
OemKeyScan determines the scanning code and Shift key status of an ASCII character in the OEM Character Set
OemToChar converts a string from the OEM character set to the ANSI character set
SetCaretBlinkTime specifies the blinking frequency of the insert operator (cursor)
SetCaretPos specifies the position of the insert Operator
SetComputerName: set the new computer name
SetCursor sets the specified mouse pointer to the current pointer
SetCursorPos: Set the pointer position
SetDoubleClickTime sets the interval between two consecutive mouse clicks that the system considers as a double-click event
SetEnvironmentVariable sets an environment variable to a specified value.
SetKeyboardState sets the current state of each virtual key on the keyboard
SetLocaleInfo changes the user's "location" Settings
SetLocalTime: set the current local time
SetSysColors: Set the color of the object displayed in the specified window.
SetSystemCursor changes any standard system pointer
SetSystemTime: set the current system time
SetSystemTimeAdjustment regularly adds a calibration value to synchronize the internal system clock with an external clock signal source
SetThreadLocale: Set the location for the current thread
SetTimeZoneInformation: Set system time zone information
ShowCaret displays the insert operator (cursor) in the specified window)
ShowCursor controls the visibility of the mouse pointer
SwapMouseButton determines whether to swap the left and right mouse keys
SystemParametersInfo: gets and sets a large number of windows System Parameters
SystemTimeToTzSpecificLocalTime converts system time to local time
ToAscii converts a virtual key into ASCII characters based on the current scan code and keyboard information.
ToUnicode converts a virtual key to a Unicode character based on the current scan code and keyboard information.
UnloadKeyboardLayout unmount the specified keyboard layout
VkKeyScan identifies the status of the virtual key code and Shift key for an ASCII character set in Windows.
End
3. menu functions
AppendMenu adds a menu item to the specified menu
CheckMenuItem
CheckMenuRadioItem
CreateMenu create a menu
CreatePopupMenu: Create an empty pop-up menu
DeleteMenu: delete a specified menu entry
DestroyMenu
DrawMenuBar is used to redraw a menu for a specified window.
EnableMenuItem allows or disables specified menu entries
GetMenu: Get the handle of a menu in the window.
GetMenuCheckMarkDimensions returns the size of a menu check mark.
GetMenuContextHelpId obtains the help scenario ID of a menu.
GetMenuDefaultItem determines which item in the menu is the default item
GetMenuItemCount returns the number of entries (menu items) in the menu.
GetMenuItemID: return the menu ID of the entry at the specified position in the menu.
GetMenuItemInfo obtains (receives) specific information related to a menu entry.
GetMenuItemRect loads the screen coordinate information of the specified menu bar in a rectangle
GetMenuState: obtains information about the status of a specified menu entry.
GetMenuString
GetSubMenu gets the handle of a pop-up menu, which is located at the specified position in the menu
GetSystemMenu gets the system menu handle of the specified window
HiliteMenuItem controls the highlighted display status of top-level menu entries
InsertMenu inserts a menu entry at the specified position of the menu, and moves other entries downward as needed
InsertMenuItem Insert a new menu entry
IsMenu determines whether the specified handle is a menu handle
LoadMenu loads a menu from a specified module or application instance
LoadMenuIndirect loads a menu
MenuItemFromPoint: determines which menu entry contains a specified Vertex on the screen.
ModifyMenu
RemoveMenu deletes a specified menu entry
SetMenu
SetMenuContextHelpId: Set the help scenario ID of a menu
SetMenuDefaultItem sets a menu entry as the default entry
SetMenuItemBitmaps sets a specific bitmap so that it can be used in the specified menu entry, instead of the standard checkmark (√)
SetMenuItemInfo sets the specified information for a menu entry
TrackPopupMenu displays a pop-up menu anywhere on the screen
TrackPopupMenuEx is similar to TrackPopupMenu, but it provides additional functions.
End
The following are some types of menu functions.
The MENUITEMINFO structure contains the menu entry information.
The structure of TPMPARAMS is used for the TrackPopupMenuEx function to support additional functions.
4. Drawing Functions
AbortPath discards all paths selected for a specified device scenario. Cancel creating any path currently in progress
AngleArc draws a line with a connection arc
Draw an Arc
BeginPath starts a path Branch
CancelDC cancels the long Drawing operation in another thread
Draw a string with Chord
CloseEnhMetaFile disables the specified Enhanced Metafile device scenario, and returns a handle to the newly created Metafile.
When CloseFigure depicts a path, close the currently opened Image
CloseMetaFile disables the specified Metafile device scenario and returns a handle to the newly created Metafile
CopyEnhMetaFile: Create a copy (copy) of the specified enhanced primitive File)
CopyMetaFile: Creates a copy of a specified (standard) Metafile.
CreateBrushIndirect creates a brush based on a LOGBRUSH Data Structure
CreateDIBPatternBrush creates a brush with a device-independent bitmap to specify the brush style (pattern)
CreateEnhMetaFile: Create an Enhanced Metafile device scenario
CreateHatchBrush creates a shadow brush
CreateMetaFile: Create a Metafile device scenario
CreatePatternBrush creates a brush with a bitmap of the specified brush pattern
CreatePen creates a paint brush with the specified style, width, and color
CreatePenIndirect creates a paint brush Based on the specified LOGPEN structure.
CreateSolidBrush create a brush with solid color
DeleteEnhMetaFile: delete a specified Enhanced Metafile.
DeleteMetaFile: delete a specified Metafile
DeleteObject: Delete the GDI object. All system resources used by the object will be released.
DrawEdge depicts the border of a rectangle with the specified Style
The DrawEscape code change function sends data directly to the display device driver.
DrawFocusRect draws a focal rectangle
DrawFrameControl depicts a standard control
DrawState applies a variety of effects to an image or drawing operation
Ellipse depicts an Ellipse surrounded by a specified rectangle
The EndPath stops defining a path.
EnumEnhMetaFile: for an enhanced-type Metafile, it lists individual Metafile records.
EnumMetaFile is a standard windows Metafile enumeration of individual Metafile records
EnumObjects enumeration brushes and brushes that can be used along with a specified device scenario
ExtCreatePen creates an extension paint brush (decoration or ry)
ExtFloodFill fills an area with the selected brush in a specified device scenario
FillPath: close any opened image in the path and fill it with the current brush.
FillRect fills a rectangle with the specified brush
FlattenPath converts all curves in a path into line segments
FloodFill fills an area in the specified device scenario with the selected brush
FrameRect draws a border around a rectangle with the specified brush
GdiComment adds a comment for the specified Enhanced Metafile device scenario
GdiFlush performs any pending drawing operations
GdiGetBatchLimit: determines how many GDI drawing commands are in the queue
GdiSetBatchLimit specifies how many GDI drawing commands can enter the queue
When GetArcDirection draws an arc, it determines the current drawing direction
GetBkColor: obtains the current background color of a specified device scenario.
GetBkMode obtains the current background filling mode for specified device scenarios.
GetBrushOrgEx determines the starting point of the selected brush in a specified device scenario
GetCurrentObject: Get the currently selected object of the specified type
GetCurrentPositionEx obtains the current paint position in the specified device scenario.
GetEnhMetaFile: obtains the metadata file handle of an Enhanced Metafile contained in the disk file.
GetEnhMetaFileBits copies the specified Enhanced Metafile to a memory buffer.
GetEnhMetaFileDescription returns the description of an Enhanced Metafile.
GetEnhMetaFileHeader: obtains the Metafile header of the enhanced primitive file.
GetEnhMetaFilePaletteEntries
GetMetaFile: Get the metadata file handle of the metadata file contained in a disk file
GetMetaFileBitsEx copies the specified Metafile to a memory buffer
GetMiterLimit: Set the slope limit (Miter) for the device scenario.
GetNearestColor obtains a solid color closest to the specified color based on the display capability of the device.
GetObjectAPI gets a structure that describes the specified object
GetObjectType determines the type of the GDI object referenced by the specified handle
GetPath gets a series of data defined for the current path
GetPixel obtains the RGB value of a pixel in a specified device scenario.
GetPolyFillMode obtains the polygon filling mode for specified device scenarios.
GetROP2 obtains the current drawing mode for a specified device scenario
GetStockObject gets an inherent object (Stock)
GetSysColorBrush gets a brush for any standard system color
GetWinMetaFileBits: fills in data for standard graph meta files in a buffer, and converts an enhanced primitive file to a standard windows Metafile
InvertRect reverses the specified rectangle in a device scenario by reversing the value of each pixel.
LineDDA enumeration all vertices in a specified line segment
LineTo draws a line with the current paint brush and connects it from the current position to a specified vertex.
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.