vb sendmessage 改变textbox中text

来源:百度知道 编辑:UC知道 时间:2024/06/17 19:57:12
如题

textbox句柄:textbox.hwnd
要设的内容:txt
如下:
SendMessage textbox.hwnd,WM_SETTEXT,0,txt

MSDN中说明:

WM_SETTEXT Message

--------------------------------------------------------------------------------

An application sends a WM_SETTEXT message to set the text of a window.

Syntax

To send this message, call the SendMessage function as follows.

lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) WM_SETTEXT, // message ID
(WPARAM) wParam, // = (WPARAM) () wParam;
(LPARAM) lParam // = (LPARAM) () lParam;
);

Parameters

wParam
This parameter is not used.
lParam
Pointer to a null-terminated string that is the window text.

Return Value

The return value is TRUE if the text