Windows is a message-driven system, and sendmessage is an application.ProgramOne of the main means of message transmission between applications, I have collected detailed parameter descriptions of the sendmessage function for your use.
VFP statement:
Declare integer sendmessage in USER32;
Integer hwnd ,;
Integer wmsg ,;
Integer wparam ,;
Integer lparam
Parameter 1: hwnd-window handle. A window can be a screen object of any type.
Parameter 2: wmsg-specifies the constant value used to distinguish other messages.
Parameter 3: wparam-a message-related constant value, or a handle to a window or control.
Parameter 4: lparam-usually a pointer to the data in the memory.
--------------------------------------------------
What kind of Windows message is wparam?
Lparam indicates the pointer to the specific content of a Windows message. It actually points to the memory address that stores the content.
Wparam and lparam are two of the most important parameters of the Windows message mechanism. The whole Windows uses these two parameters to transmit a variety of messages. The first parameter is wparam. What indicates the type of the message this time? Is it a keyboard? Is it a mouse? The keyboard is pressed or lifted, and the mouse is clicked or double-clicked. Lparam is a pointer pointing to the first address in the memory area of the information stored in this message. Obviously, this address stores things flexibly, such as mouse messages, the key status or the X and Y coordinates of the cursor may be stored here. For keyboard messages, it is the key code and so on. In short, wparam distinguishes between categories, and lparam stores the information stored by this category. Because VB does not have a pointer, we do not need more pointer operations here, but only record a first address, so we can use long instead.
--------------------------------------------------
========================================================== ======================================
Constant Value of the wmsg parameter:
========================================================== ======================================
# Define wm_create 0x01 create a window
# Define wm_destroy 0x02 sent when a window is damaged
# Define wm_move 0x03 move a window
# Define wm_size 0x05 change the size of a window
# Define wm_activate 0x06 a window is activated or inactive
# Define wm_setfocus 0x07 a window obtains the focus
# Define wm_killfocus 0x08 a window loses focus
# Define wm_enable 0x0a a window changes to enable status
# Define wm_setredraw 0x0b: Specifies whether the window can be repainted.
# Define wm_settext 0x0c application sends this message to set the text of a window
# The define wm_gettext 0x0d application sends this message to copy the text of the corresponding window to the buffer.
# Define wm_gettextlength 0x0e to get the length of the text related to a window (excluding empty characters)
# Define wm_paint 0x0f requires a window to redraw itself
# Define wm_close 0x10 send a signal when a window or application is to close
# Define wm_queryendsession 0x11 when the user selects the end dialog box or the program calls the exitwindows Function
# Define wm_quit 0x12 is used to end the program running # define wm_queryopen 0x13 send this message to an icon when the user window recovers the previous size position
# Define wm_erasebkgnd 0x14 when the window background must be erased (for example, when the window size changes)
# Define wm_syscolorchange 0x15 send this message to all top-level windows when the system color changes
# Define wm_endsession 0x16 when the system process sends the wm_queryendsession message, the message is sent to the application to notify it whether the conversation ends.
# Define wm_showwindow 0x18 when the hidden or displayed window is sent to this window
# Define wm_activateapp 0x1c send this message to the application which window is activated and which is not activated
# Define wm_fontchange 0x1d send this message to all top-level windows when the font resource library of the system changes
# Define wm_timechange 0x1e send this message to all top-level windows when the system time changes
# Define wm_cancelmode 0x1f send this message to cancel some ongoing touch (Operation)
# Define wm_setcursor 0x20 send a message to a window if the mouse causes the cursor to move in a window and the mouse input is not captured
# Define wm_mouseactivate 0x21 when the cursor is in an inactive window and the user is pressing a key of the mouse to send this message to the current window
# Define wm_childactivate 0x22 send this message to the MDI subwindow. When the user clicks the title bar of this window or the window is activated, move and change the size
# Define wm_queuesync 0x23 this message is sent by a computer-based training program. The user input message is separated by the wh_journalpalyback hook program.
# Define wm_getminmaxinfo 0x24 this message is sent to the window when it is about to change the size or position
# Define wm_painticon 0x26 is sent to the minimization window when its icon is to be repainted
# Define wm_iconerasebkgnd 0x27 this message is sent to a minimization window, only when it is before the painting icon, its background must be re-painted
# Define wm_nextdlgctl 0x28 send this message to a dialog box program to change the focus position
# Define wm_spoolerstatus 0x2a this message is sent whenever a job is added or removed in the print management queue
# Define wm_drawitem 0x2b is sent when the visual appearance of the button, ComboBox, ListBox, and menu changes
# Define wm_measureitem 0x2c when button, ComboBox, ListBox, listviewcontrol, or menuitem is created
# Define wm_vkeytoitem 0x2e this message has an lbs_wantkeyboardinput style sent to its owner to respond to the wm_keydown message
# Define wm_chartoitem 0x2f the message is sent to its owner by a list box in the lbs_wantkeyboardinput style to respond to the wm_char message.
# Define wm_setfont 0x30 when drawing text, the program sends this message to obtain the color used by the Control
# The define wm_getfont 0x31 application sends this message to obtain the font of the text drawn by the current control.
# Define wm_sethotkey 0x32 the application sends this message to connect a window to a hotkey.
# Define wm_gethotkey 0x33 the application sends this message to determine whether the hotkey is associated with a window.
# Define wm_querydragicon 0x37 this message is sent to the minimal window. When this window is to be dragged and its class does not have a defined icon, the application can return an icon or a cursor handle, this icon or cursor is displayed when you drag and drop an icon.
# Define wm_compareitem 0x39 send this message to determine the relative position of the newly added items in ComboBox or ListBox
# Define wm_compacting 0x41: The Display memory is very small.
# Define wm_windowposchanging 0x46 when the size and position of the window to which the message is sent will be changed, call the setwindowpos function or other window management functions.
# Define wm_windowposchanged 0x47 when the size and position of the window to which the message is sent have been changed, call the setwindowpos function or other window management functions.
# Define wm_power 0x48 send this message when the system is about to pause
# Define wm_copydata 0x4a send this message when one application transmits data to another application
# Define wm_canceljourna 0x4b when a user cancels the activation status of the program log, submit the message to the program
# Define wm_policy 0x4e when an event of a control has occurred or the control needs to obtain some information, send this message to its parent window
# Define wm_inputlangchangerequest 0x50
# Define wm_inputlangchange 0x51 send this message to the affected top-level window when the platform site has been changed
# Define wm_tcard 0x52 send the message to the application when the program Program has initialized the Windows Help routine
# Define wm_help 0x53 the message indicates that the user presses F1. If a menu is activated, the user sends the message to the menu associated with the window; otherwise, the message is sent to the window with focus, if no focus exists, send the message to the active window.
# Define wm_userchanged 0x54 when the user has logged on or exited and send this message to all windows. When the user logs on or exits, the system updates the user's specific settings, the system sends this message immediately when the user updates the settings.
# Define wm_policyformat 0x55 public control. The custom control and its parent window use this message to determine whether the control uses the ANSI or Unicode structure.
# Define wm_contextmenu ?? Right-click a user in a window and send the message to this window.
# Define wm_stylechanging 0x7c send this message to the window when you call the setwindowlong function to change the style of one or more windows
# Define wm_stylechanged 0x7d send this message to the window when one or more windows of the setwindowlong function are called
# Define wm_displaychange 0x7e send this message to all windows when the resolution of the monitor changes
# Define wm_geticon 0x7f this message is sent to a window to return the handle of a large icon or small icon associated with a window
# Define wm_seticon 0x80 program sends this message to associate a new large icon or small icon with a window
# Define wm_nccreate 0x81 when a window is created for the first time, this message is sent before the wm_create message is sent.
# Define wm_ncdestroy 0x82 this message notifies a window where non-customer zones are being destroyed
# Define wm_nccalcsize 0x83 send this message when the customer region of a window must be calculated
# Define wm_nchittest 0x84
# The define wm_ncpaint 0x85 program sends this message to a window. When the frame of the window must be drawn
# Define wm_ncactivate 0x86 this message is sent to a window only when its non-customer zone needs to be changed to show whether the message is active or not.
# Define wm_getdlgcode 0x87 send this message to a control associated with the dialog box program. The Widdows control orientation key and Tab key enable the input to enter this control through the corresponding
# Define wm_ncmousemove 0xa0 when the cursor moves in a non-customer area of a window, this message is sent to the non-customer area of the window: The title bar of the form and the border body of the window
# Define wm_nclbuttondown 0xa1 submit this message when the cursor is in a non-customer area of a window and the left mouse button is pressed
# Define wm_nclbuttonup 0xa2 when the user releases the left mouse button and sends the message in a window outside the customer Zone
# Define wm_nclbuttondblclk 0xa3 when you double-click the left mouse button and a window with the cursor sends this message in non-customer Zone 10
# Define wm_ncrbuttondown 0xa4 send this message when you press the right mouse button and the cursor is in a non-customer area of the window
# Define wm_ncrbuttonup 0xa5 when the user releases the right mouse and the cursor sends the message in a non-customer area of the window
# Define wm_ncrbuttondblclk 0xa6 when you right-click the user and send the message in non-customer Zone 10 in a window with the cursor
# Define wm_ncmbuttondown 0xa7 this message is sent when you press the middle mouse button and the cursor is in a non-customer area of the window
# Define wm_ncmbuttonup 0xa8 send this message when the user releases the middle mouse button and the cursor is in a non-customer area of the window
# Define wm_ncmbuttondblclk 0xa9 send this message when you double-click the middle mouse button and the cursor is in a non-customer area of the window
# Define wm_keyfirst 0x100wm_keydown press the next key # define wm_keyup 0x101 release a key
# Define wm_char 0x102 press a key and the wm_keydown and wm_keyup messages have been sent
# Define wm_deadchar 0x103 send this message to the window with focus when you use the translatemessage function to translate the wm_keyup message
# Define wm_syskeydown 0x104 when you press the Alt key and other keys, submit the message to the window with focus
# Define wm_syskeyup 0x105 when you release a key and press the Alt key to submit the message to the window with focus
# Define wm_syschar 0x106 when the wm_syskeydown message is translated by the translatemessage function, submit the message to the window with focus
# Define wm_sysdeadchar 0x107 when the wm_syskeydown message is translated by the translatemessage function, send this message to the window with focus
# Define wm_initdialog 0x110 send this message to a dialog box program before it is displayed. This message is usually used to initialize the control and execute other tasks.
# Define wm_command 0x111 when you select a menu command item or when a control sends a message to its parent window, a shortcut key is translated
# Define wm_syscommand 0x112 when you select a command in the window menu or the window receives the message when you choose to maximize or minimize it
# Define wm_timer 0x113 a timer event occurs
# Define wm_hscroll 0x114 send this message to the window when a standard horizontal scroll bar of a window generates a rolling event, and also send it to the control that owns it
# Define wm_vscroll 0x115 send this message to the window when a standard vertical scroll bar of a window generates a rolling event and send it to the control that owns it
# Define wm_initmenu 0x116 send this message when a menu is to be activated. It occurs in an item in the user menu bar or press a menu key, which allows the program to change the menu before display
# Define wm_initmenupopup 0x117 send this message when a drop-down menu or sub-menu is to be activated. It allows the program to change the menu before it is displayed, instead of changing all
# Define wm_menuselect 0x11f send this message to the menu owner when a menu item is selected (usually a window)
# Define wm_menuchar 0x120 when the menu has been activated and the user presses a key (different from the acceleration Key), this message is sent to the menu owner.
# Define wm_enteridle 0x121 send this message to its owner when a modal dialog box or menu enters the no-load status, when a modal dialog box or menu enters the no-load status, it waits for no messages in the queue after processing one or more previous messages.
# Define wm_ctlcolormsgbox 0x132 send the message to the owner window of the message box before drawing the message box in windows, in the owner window, you can set the text and background color of the message box by using the given handle of the display device.
# Define wm_ctlcoloredit 0x133 send this message to its parent window when an edit control is to be drawn by responding to this message, in the owner window, you can set the text and background color of the edit box by using the given handle of the display device.
# Define wm_ctlcolorlistbox 0x134 when a list box control is to be drawn, send this message to its parent window to respond to this message, in the owner window, you can set the text and background colors of the list box by using the given handle of the display device.
# Define wm_ctlcolorbtn 0x135 send this message to its parent window when a button control is to be drawn by responding to this message, in the owner window, you can set the text and background color of the button by using the handle of the specified display device.
# Define wm_ctlcolordlg 0x136 when the control of a dialog box is to be drawn, send this message to its parent window to respond to this message, in the owner window, you can set the text background color of the dialog box by using the corresponding display device handle.
# Define wm_ctlcolorscrollbar 0x133 send this message to its parent window when a scroll bar control is to be drawn by responding to this message, in the owner window, you can set the background color of the scroll bar by using the corresponding display device handle.
# Define wm_ctlcolorstatic 0x138 send this message to its parent window when a static control is to be drawn by responding to this message, in the owner window, you can set the text and background color of the static control by using the given handle of the display device.
# Define wm_mousefirst 0x200
# Define wm_mousemove 0x200 occurs when the mouse is moved, the same as wm_mousefirst
# Define wm_lbuttondown 0x201 press the left mouse button
# Define wm_lbuttonup 0x202 release the left mouse button
# Define wm_lbuttondblclk 0x203 double-click the left mouse button
# Define wm_rbuttondown 0x204 right-click
# Define wm_rbuttonup 0x205 release right-click
# Define wm_rbuttondblclk 0x206 right-click
# Define wm_mbuttondown 0x207
# Define wm_mbuttonup 0x208 release the middle mouse button
# Define wm_mbuttondblclk 0x209 double-click
# Define wm_mousewheel 0x20a send this message a control with current focus when the mouse wheel turns
==============================
Buttons
==============================
Message of bm_click button being clicked
bm_getcheck is used to check boxes or radio boxes and check whether it is checked.
If bm_getstate sends this message, the status of the button is returned, such as whether it is checked or whether it is available (if it is unavailable, it becomes grayed out)
If bm_setcheck has already been checked, after the message is sent, it becomes unchecked, that is, the hook is not selected. OK?
bm_setstate sets the button clicked status.
=======================< br> comboboxes
==== ===================< br> cb_addstring to add a string to comboboxes.
cb_deletestring: Delete the entries in comboboxes. Item
cb_getcount obtains the number of items in comboboxes.
cb_getcursel returns the position of the selected entry in comboboxes, and the first entry is 0. If no entries or errors exist,-1
cb_getdroppedstate is returned to send this message. You can determine whether the ListBox of comboboxes is put down. If yes, a non-zero value is returned, otherwise, 0
cb_getlbtext is returned to obtain the text of the ComboBox entry. The returned value is the length of the text.
the return value of cb_getlbtextlen is the length of the target text.
cb_insertstring inserts string entries into ComboBox. cb_resetcontent clears all ComboBox entries.
cb_setcursel sets ComboBox selected entries.
cb_showdropdown: Pull down The ListBox of ComboBox. All entries are displayed.
========================< br> editcontrols
====== ==================
em_canundo determines whether the last operation can be undo (Undo operation ). If yes, you can send em_undo
em_getfirstvisibleline to the multi-line control and find the visible row number at the top. The row number is relative to all rows.
em_getpasswordchar returns the character set of the password box. It is both the start point and end point of the selected (highlight high-volume selection) Character Set in the Editable control to view the password
em_getsel. Use the wparam parameter of sendmessage to return the start position. lparam returns the end position.
em_replacesel replaces the string in the Editable control with different strings. If no string exists in the Editable control, the message is changed to an added string
em_setpasswordchar. In the Editable control, set the character set of the password, and use * instead of
em_undo to unsend the message.
======================================
IP addresscontrol
======================================
Ipm_clearaddress clear the content of the IP address control
Ipm_getaddress: obtains the IP address information stored in the IP address control.
Ipm_isblank determines whether the IP address control can be null. Addresses such as 127.0.0.1 are empty.
Ipm_setaddress: Set ipm_setfocus in the IP address control. Set ipm_setfocus in the IP address control to obtain the keyboard input focus when you need to enter an IP address.
Ipm_setrange: Set the valid range of the input IP Address
==================================
Media control interface (MCI)
==================================
Mm_mcinotify indicates the state in which the form MCI command is completed. This state includes success, failure, or other events.
==================================
Menus
==================================
Wm_command: After you select a project in the menu, the message is sent to the form. after receiving the message, the form determines the next action wm_initmenu. When the menu is ready to be displayed, send the message to the form. The form initializes the menu item.
Wm_syscommand sends a message to the form that the user clicks the system menu. The form responds to the message and determines the next action.
======================================
Windows
======================================
Wm_close sends a message that closes the form. In some forms, a close dialog box is displayed.
Wm_gettext returns the title bar (Caption attribute) of the form ). Use wm_gettextlength to obtain the string length.
See wm_gettextlength!
After wm_help sends the message, the specified help file is displayed.
Wm_settext
===============================< br> List boxes
================================
lb_addstring Add a string to the entry
lb_deletestring delete an entry. the entry number starts from 0.
lb_getcount indicates the total number of entries.
lb_getcursel: obtain the number of option entries in The ListBox of a single choice.
lb_getsel: determines whether the list entries are selected. If yes, return a value greater than 0. otherwise, 0 is returned, indicating that the user has not selected an entry
lb_getselcount to obtain the list that can be selected multiple times and the number of items selected by the user.
lb_getselitems returns the number of the selected items in the list that can be selected multiple times. returns an array.
lb_gettext: Get the text value of one entry in the list.
lb_gettextlen: Get the length of the text value of one entry in the list.
lb_insertstring inserts an entry in the list. If yes, the sequence number of the inserted item is returned.
lb_resetcontent clears all entries in the list.
lb_setcursel: ListBox for single choice. Set the specific value of the selected item.
lb_setsel: set the specific value of the selected item.
==============================< br> mouse
=========================< br> wm_lbuttondblclk when the mouse is in a form in the specified range, double-click the left mouse button of the form. Return Value 0
wm_lbuttondown: When the mouse is in the range of a form, the left mouse button of the form has been clicked. Return Value 0 wm_lbuttonup when the mouse is in the range of a form, indicates that the left mouse button of the form has been released, and the return value is 0
wm_mbuttondblclk. When the mouse is within the range of the form, it indicates that the middle mouse button of the form has been double-clicked. Return Value: 0
wm_mbuttondown. When the mouse is in the range of a form, it indicates that the middle mouse button of the form has been clicked. 0 is returned. wm_mbuttonup. When the mouse is in the range of a form, indicates that the middle mouse button of the form has been released, and the return value is 0