USB(U盘问题) 第二个问题

calling 2004-06-21 09:28:38
请问:
在程序的运行中,当插入U盘时,程序可以自动得检查到U盘
http://community.csdn.net/Expert/topic/3103/3103152.xml?temp=.5944635
该怎样做
...全文
272 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
popmailzjw 2004-09-04
  • 打赏
  • 举报
回复
收藏一下先
calling 2004-06-25
  • 打赏
  • 举报
回复
TO :extcsdn(Studing VB now)
那就给你100分吧
Rex_love_Burger 2004-06-25
  • 打赏
  • 举报
回复
多谢!
Rex_love_Burger 2004-06-24
  • 打赏
  • 举报
回复
再有100分就三个三角裤啦,看来这两个月没有白努力啊!
Rex_love_Burger 2004-06-24
  • 打赏
  • 举报
回复
多谢!
Rex_love_Burger 2004-06-24
  • 打赏
  • 举报
回复
接分!!(只要专家分)
calling 2004-06-23
  • 打赏
  • 举报
回复
早上好
calling 2004-06-22
  • 打赏
  • 举报
回复
有人帮帮忙吗?
谢谢
calling 2004-06-22
  • 打赏
  • 举报
回复
看来又要等明天了
calling 2004-06-22
  • 打赏
  • 举报
回复
郁闷
kellerlee 2004-06-22
  • 打赏
  • 举报
回复
UP
yinweixian 2004-06-21
  • 打赏
  • 举报
回复
不明白
calling 2004-06-21
  • 打赏
  • 举报
回复
能具体点吗?
runer 2004-06-21
  • 打赏
  • 举报
回复
使用IoRegisterPlugPlayNotification()监测U盘插入
然后剩下的工作就可以按照
http://community.csdn.net/Expert/topic/3103/3103152.xml?temp=.5944635
中的方法来做了
tonymeis 2004-06-21
  • 打赏
  • 举报
回复
usb也是移动硬盘,按照移动硬盘的方法检查,有函数啊!
calling 2004-06-21
  • 打赏
  • 举报
回复
up
calling 2004-06-21
  • 打赏
  • 举报
回复
up
calling 2004-06-21
  • 打赏
  • 举报
回复
没有人帮帮忙吗?
calling 2004-06-21
  • 打赏
  • 举报
回复
老大,如果我看的明的话。我就不用来这里问问题了
runer 2004-06-21
  • 打赏
  • 举报
回复
IoRegisterPlugPlayNotification
The IoRegisterPlugPlayNotification routine registers a driver callback routine to be called when a PnP event of the specified category occurs.

NTSTATUS
IoRegisterPlugPlayNotification(
IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
IN ULONG EventCategoryFlags,
IN PVOID EventCategoryData OPTIONAL,
IN PDRIVER_OBJECT DriverObject,
IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
IN PVOID Context,
OUT PVOID *NotificationEntry
);
Parameters
EventCategory
Specifies the category of PnP event for which the callback routine is being registered. EventCategory must be one of the following:
EventCategoryDeviceInterfaceChange
PnP events in this category include the arrival (enabling) of a new instance of a device interface class (GUID_DEVICE_INTERFACE_ARRIVAL), or the removal (disabling) of an existing device interface instance (GUID_DEVICE_INTERFACE_REMOVAL).
EventCategoryHardwareProfileChange
PnP events in this category include query-change (GUID_HWPROFILE_QUERY_CHANGE), change-complete (GUID_HWPROFILE_CHANGE_COMPLETE), and change-cancel (GUID_HWPROFILE_CHANGE_CANCELLED) of a hardware profile.
EventCategoryTargetDeviceChange
PnP events in this category include events related to removing a device: the device's drivers received a query-remove IRP (GUID_TARGET_DEVICE_QUERY_REMOVE), the drivers completed a remove IRP (GUID_TARGET_DEVICE_REMOVE_COMPLETE), or the drivers received a cancel-remove IRP (GUID_TARGET_DEVICE_REMOVE_CANCELLED). This category is also used for custom notification events.
EventCategoryFlags
Specifies flags that modify the registration operation. Possible values include:
PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES
Only valid with an EventCategory of EventCategoryDeviceInterfaceChange. If set, the PnP Manager calls the driver callback routine for each device interface instance that is currently registered and active and registers the callback routine for future arrivals or removals of device interface instances.
EventCategoryData
Pointer to further information about the events for which CallbackRoutine is being registered. The information varies for different EventCategory values:
When EventCategory is EventCategoryDeviceInterfaceChange, EventCategoryData must point to a GUID specifying a device interface class. CallbackRoutine will be called when an interface of that class is enabled or removed.
When EventCategory is EventCategoryHardwareProfileChange, EventCategoryData must be NULL.
When EventCategory is EventCategoryTargetDeviceChange, EventCategoryData must point to the file object for which PnP notification is requested.
DriverObject
Pointer to the caller's driver object.
To ensure that the driver remains loaded while it is registered for PnP notification, this call increments the reference count on DriverObject. The PnP Manager decrements the reference count when this registration is removed.

CallbackRoutine
Pointer to the routine to be called when the specified PnP event occurs.
A callback routine has the following type:

typedef NTSTATUS (*PDRIVER_NOTIFICATION_CALLBACK_ROUTINE) (
IN PVOID NotificationStructure,
IN PVOID Context
);
The NotificationStructure is specific to the EventCategory. For example, a callback routine for an EventCategoryDeviceInterfaceChange receives a DEVICE_INTERFACE_CHANGE_NOTIFICATION structure.

The Context parameter contains the context data the driver supplied during registration.

The PnP Manager calls driver callback routines at IRQL = PASSIVE_LEVEL.

Context
Pointer to a caller-allocated buffer containing context that the PnP Manager passes to the callback routine.
NotificationEntry
Pointer to an opaque value returned by this call that identifies the registration. Pass this value to IoUnregisterPlugPlayNotification to remove the registration.
Return Value
IoRegisterPlugPlayNotification returns STATUS_SUCCESS or an appropriate error status.

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧