开发者

How to use Sendmessage in C#?

I got the hwnd = FindWindow(""); but how to do Sendmessage with m开发者_开发问答ouse clicks with this window ?? Thx.


using System.Runtime.InteropServices;
...
[DllImport("user32.dll")]
private static extern IntPtr SendMessage
    (IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);

For usage information look at http://msdn.microsoft.com/en-us/library/ms644950%28VS.85%29.aspx Generaly you must only call this function with good arguments, to know what arguments you need you must look at msdn.


You want to simulate mouse clicks using SendMessage?

This is a duplicate question to this one: Using SendMessage for Simulating User Mouse Clicks.

The answer there recommends that you investigate WIN32 journal hooks, thus sending WH_JOURNALPLAYBACK.

And another duplicate with what is reported to be a working snippet: Clicking mouse by sending messages

This discussion on MSDN indicates that it's not so easy using the raw mouse messages: http://social.msdn.microsoft.com/Forums/hu-HU/vbide/thread/5352d3b8-4f9e-4a0a-8575-fdd592ae45f8.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜