使用c#跨进程操作SysTreeView32
来源:互联网 发布:nfs windows 外网 编辑:程序博客网 时间:2024/06/06 20:23
项目需要模拟鼠标点击其他应用程序的SysTreeView32控件指定Item。
//define public const int TVM_ENSUREVISIBLE = 0x1100 + 20;public const int WM_LBUTTONDOWN = 0x0201;public const int WM_LBUTTONUP = 0x0202;public const int WM_MOUSEMOVE = 0x0200;[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]//BOOL WINAPI PostMessage(_In_opt_ HWND hWnd,_In_ UINT Msg,_In_ WPARAM wParam,_In_ LPARAM lParam);public static extern int PostMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]//LRESULT WINAPI SendMessage( _In_ HWND hWnd, _In_ UINT Msg, _In_ WPARAM wParam, _In_ LPARAM lParam);public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
//implementthis.RunApi(() => Win32Api.SendMessage(treeWindow.HWnd, Win32Api.TVM_ENSUREVISIBLE, 0, remoteNodePtr));this.RunApi(() => Win32Api.SendMessage(treeWindow.HWnd, Win32Api.TVM_GETITEMRECT, 1, remoteTviRectPtr));this.RunApi(() => Win32Api.ReadProcessMemory(hProcess, remoteTviRectPtr, localTviRectPtr, new UIntPtr(sizeOfTviRect), IntPtr.Zero));getedTviRect = (Win32Api.Rect)Marshal.PtrToStructure(localTviRectPtr, typeof(Win32Api.Rect));Help.DebugWrite(this, getedTviRect.ToString());//SendInputTest(getedTviRect);this.RunApi(() => Win32Api.PostMessage(treeWindow.HWnd, Win32Api.WM_MOUSEMOVE, 0, (getedTviRect.CenterY * 65536 + getedTviRect.CenterX)));this.RunApi(() => Win32Api.SendMessage(treeWindow.HWnd, Win32Api.WM_LBUTTONDOWN, 0, (getedTviRect.CenterY * 65536 + getedTviRect.CenterX)));this.RunApi(() => Win32Api.SendMessage(treeWindow.HWnd, Win32Api.WM_LBUTTONUP, 0, (getedTviRect.CenterY * 65536 + getedTviRect.CenterX)));
阅读全文
0 0
- 使用c#跨进程操作SysTreeView32
- C#使用消息(SendMessage)进行跨进程操作
- C# 跨进程通信
- C# 跨进程通信
- C#处理跨进程copy
- C#跨进程共享内存
- 跨进程操作Sqlite数据库
- 跨进程使用Boundschecker( DevPartner )
- 使用AIDL跨进程通信
- SharePreference 跨进程使用测试
- 自定义FindControl函数,跨进程使用。
- Messenger:使用消息的跨进程通信
- Messenger:使用消息的跨进程通信
- Messenger:使用消息的跨进程通信
- Messenger:使用消息的跨进程通信
- Messenger:使用消息的跨进程通信
- Messenger:使用消息的跨进程通信
- 使用AIDL来进行跨进程通信
- 每日一练(20171113)
- mac 安装 tensorflow 提示 Could not find a version that satisfies the requirement
- qt退出应用程序(exe)的方法
- js定时器
- Qt窗体接受拖入图片文件
- 使用c#跨进程操作SysTreeView32
- JAVA反射机制-EL表达式获取对象属性的原理
- 设置MyEclipse的编辑器和控制台为护眼色
- SpringMVC国际化
- Android测试,Android Studio中的单元测试、UI测试和自动化测试使用说明第二篇
- 服务器块存储统计
- iOS UIWebView 二维码识别
- 10亿次+消息、40亿次+总请求丨以58帮帮为例看58同城典型技术架构演变
- matlab_2_histogram and histogram equation