关于接收消息的问题(尚有疑问,未完待续)
2007-12-04 21:55
393 查看
由于接收消息必须要有hwnd,也就是需要有个窗口对应才能接收消息,但有些情况下不需要这个窗口却又想要能够接收消息,找了下,大概有这么些办法:
1、在一个BCB版块看到有个人提问在dll中不用窗口怎么接收消息的一个回答:
自定义一个窗口句柄:
申请:AllocateHWnd
释放:DeallocateHWnd
就可以接受和发送消息啦
2、建立一个普通的隐藏窗口,只用于处理消息,不干其它事情
3、建立一个“消息窗口(Message-Only窗口)”,这种窗口仅仅用于处理消息,而不能被显示出来。
在创建时指定CreateWindowEx的参数hwndParent为HWND_MESSAGE. 或在创建窗口后SetParent(hWnd, HWND_MESSAGE);即可建立一个“消息窗口”
附:
Message-Only Windows
A message-only window enables you to send and receive messages. It is not visible, has no Z order, cannot be enumerated, and does not receive broadcast messages. The window simply dispatches messages.
To create a message-only window, specify the HWND_MESSAGE constant or a handle to an existing message-only window in the hWndParent parameter of the CreateWindowEx function. You can also change an existing window to a message-only window by specifying HWND_MESSAGE in the hWndNewParent parameter of the SetParent function.
To find message-only windows, specify HWND_MESSAGE in the hwndParent parameter of the FindWindowEx function. In addition, FindWindowEx searches message-only windows as well as top-level windows if both the hwndParent and hwndChildAfter parameters are NULL.
备注:第一个方法未测试。第三个方法关于“消息窗口”用百度搜索几乎找不到什么更多的资料,有待增加相关资料
1、在一个BCB版块看到有个人提问在dll中不用窗口怎么接收消息的一个回答:
自定义一个窗口句柄:
申请:AllocateHWnd
释放:DeallocateHWnd
就可以接受和发送消息啦
2、建立一个普通的隐藏窗口,只用于处理消息,不干其它事情
3、建立一个“消息窗口(Message-Only窗口)”,这种窗口仅仅用于处理消息,而不能被显示出来。
在创建时指定CreateWindowEx的参数hwndParent为HWND_MESSAGE. 或在创建窗口后SetParent(hWnd, HWND_MESSAGE);即可建立一个“消息窗口”
附:
Message-Only Windows
A message-only window enables you to send and receive messages. It is not visible, has no Z order, cannot be enumerated, and does not receive broadcast messages. The window simply dispatches messages.
To create a message-only window, specify the HWND_MESSAGE constant or a handle to an existing message-only window in the hWndParent parameter of the CreateWindowEx function. You can also change an existing window to a message-only window by specifying HWND_MESSAGE in the hWndNewParent parameter of the SetParent function.
To find message-only windows, specify HWND_MESSAGE in the hwndParent parameter of the FindWindowEx function. In addition, FindWindowEx searches message-only windows as well as top-level windows if both the hwndParent and hwndChildAfter parameters are NULL.
备注:第一个方法未测试。第三个方法关于“消息窗口”用百度搜索几乎找不到什么更多的资料,有待增加相关资料
相关文章推荐
- 关于接收消息的问题(尚有疑问,未完待续)
- 关于dll中接收消息的问题
- 关于ActiveMQ消息接收的问题
- 关于 微信发送被动回复音乐消息 用户接收不到的问题
- 关于Java连接虚拟机中的Kafka时,无法发送、接收消息的问题
- 关于接入第三方推送,国产手机无法接收到推送消息的的问题
- 关于百度云、极光的推送的问题,为什么控制台发送消息成功,而手机端接收不到消息
- 关于无法接收消息推送问题的修改
- 关于在接收推送消息后PendingIntent传参问题
- 关于WM_NOTIFY消息接收窗口的问题
- 关于无法接收消息推送问题的修改
- 关于MNS消息发送和接收的实现问题
- 关于CSocket::Accept()能不能作为接收客户端消息循环的判断条件
- 关于VC++中,两种自定义消息的发送与接收的方法实现进行说明。
- 关于非模式对话框(Modeless Dialog)无法响应WM_KILLFOCUS消息问题
- 关于tomcat7 配置 maxPostSize="0" 时,后台无法接收前台参数的问题
- Socket通讯消息接收问题
- 请教关于消息传递的问题
- 关于NextGrid控件和cxTreeList控件中的子节点问题(未完待续)
- Celery 在Django 环境下无法接收消息问题解决