Article View: borland.public.cppbuilder.nativeapi
Article #3343Re: Detecting media insertion/removal
From: Mike Wynne
Date: Wed, 28 Jun 2006 06:22
Date: Wed, 28 Jun 2006 06:22
30 lines
2358 bytes
2358 bytes
"Remy Lebeau (TeamB)" wrote...
> Are you calling RegisterDeviceNotification() at all? The OS sends only
> basic device notifications by default. You have to manually register for
> more advanced events.
I think this is at the heart of my problem. I do include a
RegisterDeviceNotification() at initialisation but I'm not 100% sure what I
should be registering for. My code includes:
HDEVNOTIFY hDevNotify;
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
memset(&NotificationFilter, 0, sizeof(NotificationFilter));
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
NotificationFilter.dbcc_classguid = GUID_DEVCLASS_DISKDRIVE;
hDevNotify = RegisterDeviceNotification( Application->Handle,
&NotificationFilter,
DEVICE_NOTIFY_WINDOW_HANDLE);
Though this doesn't make any difference. I can comment it out and still get
exactly the same messages arriving. Maybe I should be registering
DBT_DEVTYP_VOLUME - though since these cards are not FAT or NTFS formatted I
don't know if that would work?
Thanks,
MikeW
Technical Details
Message-ID:
<44a22030@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!news.m-online.net!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailReferences:
<44a17fbc$1@newsgroups.borland.com> <44a1a4e8$1@newsgroups.borland.com> <44a1aa53@newsgroups.borland.com> <44a1c9cc$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e15854a90a45465d X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mike Wynne" <mikeywyn@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <44a17fbc$1@newsgroups.borland.com> <44a1a4e8$1@newsgroups.borland.com> <44a1aa53@newsgroups.borland.com> <44a1c9cc$1@newsgroups.borland.com> Subject: Re: Detecting media insertion/removal Date: Wed, 28 Jun 2006 07:22:42 +0100 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 62.188.49.47 Message-ID: <44a22030@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1151475760 62.188.49.47 (27 Jun 2006 23:22:40 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!news.m-online.net!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail