微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何点击“是”button,以编码方式申请应用程序

我有一个代码

private const int WM_CLOSE = 16; private const int BN_CLICKED = 245; [DllImport("User32.dll")] public static extern Int32 FindWindow(String lpClassName,String lpWindowName); [DllImport("user32.dll",CharSet = CharSet.Auto)] public static extern int SendMessage(int hWnd,int msg,int wParam,IntPtr lParam); [DllImport("user32.dll",SetLastError = true)] public static extern IntPtr findwindowex(IntPtr parentHandle,IntPtr childAfter,string className,string windowTitle); [DllImport("user32.dll",EntryPoint = "FindWindow",SetLastError = true)] private static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly,string lpWindowName); public void Click(string _btnTitle) { int hwnd = 0; IntPtr hwndChild = IntPtr.Zero; //Get a handle for the Calculator Application main window // foreach (Process p in Process.GetProcesses()) //{ hwnd = FindWindow(null,FrmTitle); if (hwnd != 0) { hwndChild = findwindowex((IntPtr)hwnd,IntPtr.Zero,"Button",_btnTitle); SendMessage((int)hwndChild,BN_CLICKED,IntPtr.Zero); } }

我不能点击应用程序的MessageBox上的“是”

任何人有小费? TKS

用于测量ac程序在linux中的运行时间

如何将重复调用的外部进程集成到Java Web应用程序中?

如何实现确定性malloc

在C中访问大文件

如何以编程方式在Linux上设置硬件时钟?

recursion查找子目录和文件

构build一个makefile依赖/inheritance树

检测出口处释放的C内存“泄漏”

input文本并保存到文件

GLFW无法创build窗口:“GLX:无法创build上下文:GLXBadFBConfig

你没有发送正确的信息。

尝试在SendMessage()的调用中使用BM_CLICK (0x00F5)。 这应该工作,只要hwndChild是按钮的窗口句柄,而不是容器对话框。

BN_CLICKED不起作用,因为这是通知代码,而不是消息。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐