在C ++非GUI应用程序中检测USB插入/删除 [英] Detecting USB insertion/Removal in C++ non-GUI application

查看:189
本文介绍了在C ++非GUI应用程序中检测USB插入/删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过在后台运行且没有GUI的C ++应用程序检测特定(自定义)USB设备的插入/删除。

I want to detect insertion/removal of a specific (Custom) USB device through a C++ application which runs in background and has no GUI.

我已经看过很多的问题及其解决方案 RegisterDeviceNotification 还包含 MSDN上的示例代码

I have seen lot of questions and their solutions RegisterDeviceNotification also sample code on MSDN

但是这些应用程序都有一些窗口/窗体/ GUI。我的应用程序没有任何。
我如何在我的应用程序中使用这个?

But these all application has Some Window/Form/GUI. My Application doesn't have any. How can I use this in my application?

我的最后一个选项是创建一个不可见的窗口...但有没有其他方法出来?

My last option would be to create an invisible window... But is there any other way out??

推荐答案

创建 message-only window 。尽管名字,它只是一个消息队列。

Create a message-only window. Despite the name, it's really only a message queue.

这篇关于在C ++非GUI应用程序中检测USB插入/删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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