- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
另一个应用程序有时会显示标题为“Test”的 MessageBox 和 MessageBox 主体内部的一些消息,我如何从另一个应用程序(用 C++ 或 C# 编写)获取此消息然后关闭它? C# 代码:
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd,uint Msg,int wParam,int lParam);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
for (int i = 0; i < 40; i++) // just test cycle
{
IntPtr window = FindWindow(null, "Test");
if (window != IntPtr.Zero) // ok we found it!
{
// code that reads MessageBox message?
.....
// work is done, closing
SendMessage((int)window, WM_SYSCOMMAND, SC_CLOSE, 0);
break;
}
System.Threading.Thread.Sleep(50);
}
你能帮我解决这个问题吗?我该怎么做?
最佳答案
查看 this thread .
选择 1:
You can use an API like Spy++ to access other windows controls.
选择 2:
you should use Windows APIs like EnumWindow or FindWindow then use EnumChildWindows API to find the controls in the target window, like the textbox you are looking for, then the API SetWindowText
have a look here for some ideas: Why is EnumChildWindows skipping children? also search for these APIs names here in Stack Overflow and you will find many examples...
选择 3:
I found this api which may allow you to complete your task : http://www.programmersheaven.com/download/56171/download.aspx
关于c# - 如何获取另一个进程MessageBox的消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22427565/
我遇到了一个奇怪的问题。我正在 VC++ 2008 中制作 Win32 应用程序,制作一个类来封装大部分工作,以便在调用 MessageBox 时轻松重复。 .消息框已创建(我认为),但除非我按下 A
如果我的应用程序崩溃,我会使用 ExceptionFilter 来捕获崩溃,执行一些最终操作,然后向用户显示应用程序已崩溃的消息框。 因为应用程序已经崩溃,我能(或不敢)做的事情不多,因为如果我做的太
既然“messagebox”是“tkinter”包中的一个模块,为什么我必须使用 from tkinter import messagebox 代替 import tkinter.messagebox
出于某种原因,WPF MessageBox 看起来比 WindowsForms 中的更糟糕。 WPF 没有视觉样式。 如何将 Windows 样式应用于 WPF MessageBox? Windows
我无法找出两个消息框之间的主要区别。 System.Windows.MessageBox 和 System.Windows.Forms.MessageBox 有什么区别? 最佳答案 System.Wi
我通过将位图的构建操作设置为Splashscreen来使用WPF中的SplashScreen功能。在启动屏幕后面,正在检查许可信息,如果失败,我会显示一个 MessageBox。 根据这个Feedba
我正在使用http://dev.sencha.com/playpen/docs/output/Ext.MessageBox.html#prompt显示 extjs 提示,用户可以在其中输入一些文本,然
有了这个,默认就可以了。我可以设置默认取消吗? MessageBoxResult result = MessageBox.Show (message, caption, Messag
我正在将第三方基于 C 的 SDK 集成到我的 .NET 应用程序中。该应用程序将作为 Windows 服务在服务器上运行,因此它不应以任何方式与用户交互。 不幸的是,在某些错误情况下,它坚持调用 M
我有一个程序可以让用户在 2 个值之间进行选择。为此,我想打开一个带有 2 个按钮(确定、取消)和一个可供选择或写入值的字段的框。就像 QMessageBox 一样,可以填写/选择数据。我可以创建一个
如何将自定义按钮添加到 WPF 中现有的 MessageBox 中?除了通常的“确定”和“取消”按钮之外,我还需要添加 3 个按钮并处理它们的事件。 最佳答案 简短回答:不,这是不可能的,您需要编写一
我在 Windows 窗体上有几个组框,其中包含复选框、数字选择器和组合框。如果未选中该复选框,我希望禁用其他元素。我已经禁用了除加载复选框之外的所有内容,然后在 CheckedChanged 事件上
我有一个 c# 程序,正在尝试使用特定字符串(普通字符串,没什么特别的)调用 messageBox,并且当到达要与字符串连接的变量时,它显然会停止连接。代码: string first = userI
我一直认为 MessageBoxes 有点像断点——它们会阻止程序执行,直到用户单击“确定”。但是,我刚刚发现这是不准确的,我正试图弄清楚 MessageBoxes 何时会和不会停止执行。 通过 SO
我正在尝试显示一条简单的消息,我过去可能已经这样做过数千次,而现在……完整的文本字符串没有显示在 MessageBox 中。我没有做任何不同的事情,所以我没有看到问题。这是我的代码: if (Mess
我在使用模态消息框时遇到问题。 情况是这样的 用户从表单中选择 xx 出现消息框 用户打开嵌入式软件键盘(内置键盘,来自设备) 用户关闭键盘 MessageBox 失去焦点(怎么会?它应该是模态的!)
我正在使用 Kinect 开发一个使用 C# 和 WPF 的图像查看应用程序。当用户将双手放在头顶时,我会显示一个 Messagebox 询问用户是否真的想退出: //Quit if both
当我点击回车按钮时,显示MessageBox。当我像往常一样再次单击输入按钮时,我希望 MessageBox 关闭。问题是 - 它没有焦点,但 TextBox 有,当我单击输入按钮时 _textBox
我正在尝试找到一种从线程内部调用 MessageBox 的方法。但是我发现的每一段代码/示例都不起作用。有人可以用尽可能少的代码行以最简单、最简单的方式详细说明解决方案/示例吗? 到目前为止,这是我的
我在如下启动的 WPF 应用程序中有一个简单的消息框: private void Button_Click(object sender, RoutedEventArgs e) { Message
我是一名优秀的程序员,十分优秀!