问题标签 [postmessage]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
5636 浏览

c++ - 以编程方式更改组合框

我需要combobox使用新值更新 a ,以便更改其中的反射文本。最干净的方法是在combobox初始化并带有消息之后。

所以我正在尝试为postmessage包含combobox.

所以如果我想向它发送一条消息,将当前选中的项目更改为第 n 个项目,postmessage会是什么样子?

我猜它会涉及ON_CBN_SELCHANGE,但我无法让它正常工作。

0 投票
1 回答
955 浏览

windows - 在 Windows Mobile 中使用 PostMessage 模拟菜单选择

我正在编写一个例程,为我的 Windows Mobile 5 应用程序中的任何菜单项提供用户可定义的键盘快捷方式,该应用程序使用 C++/MFC。为此,我获取所有可用的菜单命令 ID,并使用 CWnd::PostMessage(WM_COMMAND,MyMenuID) 将其发布到应用程序。我在其他地方使用这种技术对线程间通信有很好的效果,但不适用于菜单命令 ID。任何想法为什么这不起作用。该应用程序是文档视图,我尝试过发布到 CMainFrame 和 CView 派生窗口。我可以写一个糟糕透顶的 switch 语句,但我觉得发布一条消息应该可行。

编辑:好的,我尝试了很多东西,包括这篇文章的建议,但无济于事。大丑 switch 声明现在是,如果我发现更好的,我会再次更新。

0 投票
2 回答
3814 浏览

ui-automation - 如何以编程方式在 Windows 中选择弹出菜单项?

我有一个应用程序,我正在为其编写一个小向导。它通过将鼠标移动到适当的按钮、菜单并单击它们来自动化应用程序的一小部分,以便用户可以观看。

到目前为止,它将鼠标移动到树项目并发送右键单击。通过 TrackPopupMenu 弹出一个菜单。接下来,我将鼠标移动到弹出菜单上的相应项目。我不知道如何选择菜单项。

我尝试将左键单击发送到菜单的所有者窗口,尝试将 WM_COMMAND 发送到菜单的所有者等。没有任何效果。

我想菜单本身就是一个窗口,但我不知道如何从我拥有的 HMENU 中获取它的 HWND。

关于如何 PostMessage 单击弹出菜单有什么想法吗?

PS 我使用单独的线程来驱动鼠标和发布消息,所以 TrackPopupMenu 同步没有问题。

0 投票
2 回答
3198 浏览

delphi - 如何使用 PostMessage 发送 WM_HOTKEY?

我想使用全局桌面 HotShortCut 发送 WM_HOTKEY 以被其他应用程序捕获。

预期的键是 CTRL + F10

这是我发现触发 WM_HOTKEY 捕获的唯一方法:

如果我更改 Msg.LParamLo 或 Msg.LParamHi 的任何值,WM_HOTKEY 不会被其他应用程序触发。但是使用这种方式,在消息 WM_HOTKEY 被 Method 捕获之前:

执行“Windows 执行对话框”(快捷键“Windows 键”+R)

如何正确传递 Msg.LParamLo 和 Msg.LParamHi,以确保我发送 WM_HOTKEY +“CTRL + F10”。

0 投票
8 回答
9672 浏览

delphi - PostMessage in service applications

There is a problem I am unable to solve. I created two service applications in Delphi and tried to post messages within them. Of course, there are no windows in such applications and PostMessage needs a window handle parameter to send a message.

Therefore, I created a window handle using the AllocateHWnd(MyMethod: TWndMethod) function and passed, as the 'MyMethod' parameter, a procedure I want to be called when a message is received. If it was a windowed application, PostMessage() called using the handle returned by the AllocateHWnd method would certainly send a message that would then be received by the 'MyMethod' procedure.

The situation, however, is different in my service applications. I do not understand why, but in one of them posting messages this way works fine, whereas in the second one it does not (the messages are not received at all). Only when the service is being stopped do I notice that two messages are received by 'MyMethod': WM_DESTROY and WM_NCDESTROY. The messages I send using PostMessage are never received by this procedure. On the other hand, the first service always receives all messages I send.

Could you please give me a clue that would help me find the reason of the second service not receiving my messages? I do not know in what way they can differ. I checked the settings of the services and they seem to be identical. Why then one of them works fine and the second one does not (as far as sending messages is concerned)?

Thanks for any advice. Mariusz.

0 投票
5 回答
43465 浏览

c# - 我不明白如何使用 SendMessage 或 PostMessage 调用

我需要在第三方应用程序中模拟按键。假设我有一个需要向计算器应用程序发送“8”的 C# 应用程序。我不能使用 .Net 的 SendKeys 或 win32 api 的 keybd_event ,因为它们都要求窗口是最活跃的窗口,而我的情况并非如此。

这样就剩下调用 sendMessage 和 postMessage 了。在过去的三个小时里,我一直在尝试获得一些结果,但现在我完全没有希望了。

我有以下内容:

如您所见,我进行了四次尝试与计算器进行通信。使用 sendMessage 和 PostMessage 关闭窗口并发送密钥 7. 没有任何效果。FindWindow 方法有效,因为我得到了应用程序的处理程序(我什至尝试自己启动进程并使用 process.MainWindowHandler 访问它,但没有运气)。没有错误或异常,但它在计算器中没有任何作用。

我也用记事本尝试了完全相同的东西,也没有任何改变。

0 投票
2 回答
1641 浏览

winapi - 确定窗口消息队列深度

我们有一个应用程序使用窗口消息队列将数据从套接字传递到消费者 HWND(速率约为 2100Hz)。此应用程序已经工作了 2 年以上。最近,我们的应用程序开始出现 WM_TIMER 没有被我们的应用程序触发/执行的问题。我认为这是由于数据被泵入消息队列。

我的问题是有没有办法确定给定线程/HWND 的消息队列中有多少待处理消息?

0 投票
4 回答
3259 浏览

c++ - 双击列表视图(c++,不是 .net!)

我想双击一个列表视图。从我在 msdn 上读到的内容看来,我必须发送一条 WM_NOTIFY 消息和带有 NM_DBLCLK 的东西。但我不太了解如何实施它。我之前使用过 SendMessage,但 MSDN 并不清楚如何填充结构,因此:

WM_NOTIFY http://msdn.microsoft.com/en-us/library/bb775583(VS.85).aspx NM_DBLCLK http://msdn.microsoft.com/en-us/library/bb774867(VS.85).aspx

0 投票
1 回答
1800 浏览

java - Java(Android) 中的 PostMessage() 替代方案

我正在重写现有的 C++ 应用程序并使其适应 Android 环境。

在代码中有一个 PostMessage 语句:

有谁知道在 Android (Java) 中实现相同结果的最合适方法是什么?

通过以下方式创建两种方法是否足够好,例如 OnLogin() 和 OnClose():

然后写

?

0 投票
5 回答
3446 浏览

c# - 如何将消息从托管应用程序的一个实例发送到另一个实例?

我有一个 WinForms 应用程序,如果已经有一个实例正在运行并且用户试图启动另一个实例,我会在调用 Application.Run() 之前通过检查 Mutex 来停止它。那部分工作得很好。我想做的是在终止新进程之前将一条消息从应用程序的新实例(以及一条字符串形式的数据)传递到现有实例。

我已经尝试调用 PostMessage,并且确实在正在运行的应用程序上收到了消息,但是我在 lparam 中传递的字符串失败(是的,我已经检查以确保我传递了一个好的字符串开始) . 我怎样才能最好地做到这一点?

在其他地方,以我的形式...