发送消息到窗口句柄 [英] send message to a window handle
本文介绍了发送消息到窗口句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我运行exe文件,通过它我得到了另外一个exe文件的控件的句柄。现在我想做的是将消息发送到从我的exe文件的特殊手柄
I'm running an exe through which I get a handle of a control in another exe. Now what I want to do is send messages to the particular handle from my exe.
推荐答案
您需要使用导入功能:
You need to import the function using:
[DllImport("user32.dll")]
public static extern int SendMessage(
int hWnd, // handle to destination window
uint Msg, // message
long wParam, // first message parameter
long lParam // second message parameter
);
和定义要发送类似的消息:
and define the message that you want to send like:
public const int <WM_YOURMESSAGE> = <yourvalue>;
,然后调用SendMessage函数像任何其他功能。
and then call SendMessage like any other function.
这篇关于发送消息到窗口句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文