Getcursorpos/windowfrompoint/sendmessage (use the API function to send characters to the edit box)
Getcursorpos (mpoint ); Dtwnd: = windowfrompoint (mpoint ); Sendmessage (dtwnd, wm_ime_char, ord ('A'), 1 ); The preceding three functions are described as follows: Getcursorpos: Function: This function checks the position of the optical mark, expressed in screen coordinates. Function prototype: bool getcursorpos (lppolnt ippoint ); Parameters: Ippint: point structure pointer, which receives the screen coordinates of the cursor. Return Value: If successful, the returned value is non-zero. If failed, the returned value is zero. To obtain more error information, call the getlasterror function. Note: The cursor position is usually given in the form of screen coordinates. It is not affected by the ing mode of the window containing the cursor. This call process must have the winsta_readattributes access permission on the window site. Quick query: Windows NT: 3.1 and later versions: Windows: 95 and later versions; Windows CE: not supported; header file: winuser. h; library file: user32.lib. -------------------------------------------------------------------- Windowfrompoint: Function: This function obtains the handle of the window containing the specified vertex. Function prototype: hwnd windowfrompoint (point ); Parameters: Point: Specifies the point structure of a detected point. Return Value s: the return value is the handle of the window containing the vertex. If the window containing the specified vertex does not exist, the return value is null. If the point is above the static text control, the return value is the window below the static text control. Note: The windowfrompoint function does not obtain a hidden or prohibited window handle, even if it is in this window. Applications should use the childwindowfrompoint function for unrestricted queries. Quick query: Windows NT: 3.1 or later: Windows: 95 or later; Windows CE: 1.0 or later: header file: winuser. h; library file: user32.lib. _____________________________________________________________________ Sendmessage: |
Function: This function sends a specified message to one or more windows. This function calls the window program for the specified window until the window program finishes processing the message and returns it. The postmessage function returns a message immediately after it is sent to the Message Queue of a thread.
Function prototype: lresult sendmessage (hwnd, uint MSG, wparam, lparam iparam );
Parameters:
Hwnd: the handle of the window whose window program will receive messages. If this parameter is hwnd_broadcast, the message is sent to all top-level windows in the system, including invalid or invisible non-self-owned windows, overwritten windows, and pop-up windows, however, messages are not sent to subwindows.
MSG: Specifies the message to be sent.
Wparam: Specify the additional message.
Iparam: Specify the attached message.
Return Value: the return value specifies the message processing result, depending on the sent message.
Note: applications that need to communicate with hwnd_broadcast should use the registerwindowmessage function to obtain a unique message for communications between applications.
If the specified window is created by the calling thread, the window program is called as a subroutine immediately. If the specified window is created by different threads, the system switches to the thread and calls the appropriate window program. Messages between threads are processed only when the thread executes the message retrieval code. The sending thread is blocked until the receiving thread finishes processing the message.