BroadcastSystemMessage将大量消息发送到一个应用程序 [英] BroadcastSystemMessage sends lots of messages to one application

查看:80
本文介绍了BroadcastSystemMessage将大量消息发送到一个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用文章将我的应用程序仅限制为一个实例.

此源代码还支持将命令行信息发送到先前打开的应用程序.它使用BroadcastSystemMessage函数发送数据.但是我的应用程序实例收到很多消息,并尝试对其进行解析.

可能是什么问题? (我只希望收到一条消息)

我只需要向上一个应用程序发送一条消息.我尝试使用PostMessage(...)函数,但是由于MDI应用程序始终更改其标题,因此FindWindow函数遇到一些问题.我尝试使用RegisterClass函数并在FindWindow中调用其名称,但没有任何反应.

任何帮助将不胜感激,
预先感谢,
Andrey.

I used this article to restrict my application to one instance only.

This source code also has support of sending command-line info to the previously opened application. It uses BroadcastSystemMessage function to send data. But instance of my application receives lots of messages and tries to parse it.

What might be the problem? (I expected only one message to come)

I need to send only one message to previous application. I tried using PostMessage(...) function, but I experience some problems with FindWindow function, as MDI application always changes its caption. I tried to use RegisterClass function and call its name in FindWindow, but nothing happened.

Any help would be appreciated,
Thanks in advance,
Andrey.

推荐答案

您不想使用BroadcastSystemMessage,因为您会收到所有系统消息.您想在两个应用程序中都注册一条消息,然后仅对该消息进行响应.

我会看一下有关进程间通信的文章:

进程间通信教程 [
You don''t want to use BroadcastSystemMessage, because you get ALL system messages. You want to regsiter a message in both apps, and respond only to that message.

I would look at this article regarding inter-process communications:

Interprocess communication tutorial[^]


是的,有一条消息,已为应用程序注册,并且有一个功能,它接受此消息.我不明白为什么BroadcastSystemMessage会将其中很多发送到一个应用程序.
Yes, there is a message, registered for an application and there is a function, which accepts this message. I don''t understand why BroadcastSystemMessage send lots of them to one application..


这篇关于BroadcastSystemMessage将大量消息发送到一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆