SendMessage(hwnd, M_LBUTTONDOWN, 0, 0)首先你要知道要做一件什么事情,使用什么API,既然你用sendmessage那当然是发送消息了 然后你要查sendmessage是什么声明 LRESULT SendMessage( HWND hWnd, // handle to destination window UINT Msg, // message WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); hwnd代表控件的句柄 Uint代表要发送的消息 WPARAM和LPARAM就是要根据要发送的消息,也就是UNIT的状态来判断首先你的问题就是一个错误的问题,因为在整个消息中间没有任何一个消息会以 M_去打头, 我想你大概是 WM_LBUTTONDOWN,你如果不知道这个消息是做什么用,你可以去MSDN查,查到以后定位就可知属于Mouse input message,也就是鼠标消息了然后再去MSDN中间关于WM_LBUTTONDOWN的注释 wParam //这代表第一个代数怎么用 Indicates whether various virtual keys are down. This parameter can be one or more of the following values. Value Description MK_CONTROL The CTRL key is down. MK_LBUTTON The left mouse button is down. MK_MBUTTON The middle mouse button is down. MK_RBUTTON The right mouse button is down. MK_SHIFT The SHIFT key is down. MK_XBUTTON1 Windows 2000/XP: The first X button is down. MK_XBUTTON2 Windows 2000/XP: The second X button is down. lParam //这是第2个参数 The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 里面也写得非常清楚了。说这么多是说一种学习方法,英语不好并不是借口,如果你想VB不只是表面上使用必须要学会使用API,而API当然要看SDK咯我想你大概是看了某些书啊网页上的示范,请记住一点,书和网页往往会有错误的,而MSDN是最好的老师,不要不懂照抄,那样永远是肤浅
第三个参数是传按键,如:MK_LBUTTON,MK_MBUTTON,MK_RBUTTON第四个参数是传坐标,Y坐标在高16位,X坐标在低16位.
可以这样计算:Y * &H10000 Or X
向text1发送字符串"test"
然后你要查sendmessage是什么声明
LRESULT SendMessage(
HWND hWnd, // handle to destination window
UINT Msg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
hwnd代表控件的句柄
Uint代表要发送的消息
WPARAM和LPARAM就是要根据要发送的消息,也就是UNIT的状态来判断首先你的问题就是一个错误的问题,因为在整个消息中间没有任何一个消息会以 M_去打头,
我想你大概是 WM_LBUTTONDOWN,你如果不知道这个消息是做什么用,你可以去MSDN查,查到以后定位就可知属于Mouse input message,也就是鼠标消息了然后再去MSDN中间关于WM_LBUTTONDOWN的注释
wParam //这代表第一个代数怎么用
Indicates whether various virtual keys are down. This parameter can be one or more of the following values. Value Description
MK_CONTROL The CTRL key is down.
MK_LBUTTON The left mouse button is down.
MK_MBUTTON The middle mouse button is down.
MK_RBUTTON The right mouse button is down.
MK_SHIFT The SHIFT key is down.
MK_XBUTTON1 Windows 2000/XP: The first X button is down.
MK_XBUTTON2 Windows 2000/XP: The second X button is down.
lParam //这是第2个参数
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 里面也写得非常清楚了。说这么多是说一种学习方法,英语不好并不是借口,如果你想VB不只是表面上使用必须要学会使用API,而API当然要看SDK咯我想你大概是看了某些书啊网页上的示范,请记住一点,书和网页往往会有错误的,而MSDN是最好的老师,不要不懂照抄,那样永远是肤浅