Thread View: borland.public.cppbuilder.nativeapi
22 messages
22 total messages
Started by Uri
Tue, 17 Oct 2006 12:57
OnDeviceChange Problem
Author: Uri
Date: Tue, 17 Oct 2006 12:57
Date: Tue, 17 Oct 2006 12:57
27 lines
1431 bytes
1431 bytes
Hi, when I connect OR disconnect the USB connector I reach the
breakpoint in function "OnDeviceChange", but the parameters
of 'm' are stay the same (it is not right), why?
Thanks.
public: // User declarations
__fastcall TUSBApp_form(TComponent* Owner);
// Overriding a message handle
//Messages::TMessage message;
void OnDeviceChange(Messages::TMessage );
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_DEVICECHANGE , Messages::TMessage , OnDeviceChange)
END_MESSAGE_MAP(TComponent)
//---------------------------------------------------------------
void TUSBApp_form::OnDeviceChange(Messages::TMessage m)
{
//USBC->OnDeviceChange(m);
return; // Breakpoint Here
}
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Tue, 17 Oct 2006 14:38
Date: Tue, 17 Oct 2006 14:38
27 lines
1657 bytes
1657 bytes
Uri wrote:
> Hi, when I connect OR disconnect the USB connector I reach the
> breakpoint in function "OnDeviceChange", but the parameters
> of 'm' are stay the same (it is not right), why?
> void TUSBApp_form::OnDeviceChange(Messages::TMessage m)
You have to test against m.WParam. Something like:
switch(m.WParam)
{
case DBT_DEVICEARRIVAL:
//a new device has been inserted
break;
case DBT_DEVICEREMOVECOMPLETE:
//a device has been removed
break;
}
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------
Re: OnDeviceChange Problem
Author: Uri
Date: Tue, 17 Oct 2006 14:45
Date: Tue, 17 Oct 2006 14:45
21 lines
1352 bytes
1352 bytes
I tried that, it's not working, every time when the function is
call (when I connect or remove the USB device from the PC) the
parameter 'm.WParam' stay 7 (m.WParam = 7) Why does it not chaning?
Uri.
>You have to test against m.WParam. Something like:
>
>switch(m.WParam)
>{
> case DBT_DEVICEARRIVAL:
> //a new device has been inserted
> break;
> case DBT_DEVICEREMOVECOMPLETE:
> //a device has been removed
> break;
>}
>
>Michel
Re: OnDeviceChange Problem
Author: Bob Gonder
Date: Tue, 17 Oct 2006 16:08
Date: Tue, 17 Oct 2006 16:08
25 lines
1645 bytes
1645 bytes
Uri wrote:
>I tried that, it's not working, every time when the function is
>call (when I connect or remove the USB device from the PC) the
>parameter 'm.WParam' stay 7 (m.WParam = 7) Why does it not chaning?
Look in DBT.H
7 is DBT_DEVNODES_CHANGED which you should be ignoring as Michel
pointed out.
>>switch(m.WParam)
>>{
>> case DBT_DEVICEARRIVAL:
>> //a new device has been inserted
>> break;
>> case DBT_DEVICEREMOVECOMPLETE:
>> //a device has been removed
>> break;
>>}
>>
>>Michel
Just a thought:
It could be that the mystery device you are unplugging isn't supposed
to report device arrival/removed. You might ask the manufacturer.
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Tue, 17 Oct 2006 16:12
Date: Tue, 17 Oct 2006 16:12
19 lines
1664 bytes
1664 bytes
Uri wrote: > I tried that, it's not working, every time when the function is > call (when I connect or remove the USB device from the PC) the > parameter 'm.WParam' stay 7 (m.WParam = 7) Why does it not chaning? That's a DBT_DEVNODES_CHANGED. According to MSDN : "The system broadcasts the DBT_DEVNODES_CHANGED device event when a device has been added to or removed from the system." It seems there is no way to know if the device has been added or removed from the system. Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: OnDeviceChange Problem
Author: Remy Lebeau (TeamB)
Date: Tue, 17 Oct 2006 17:04
Date: Tue, 17 Oct 2006 17:04
13 lines
1261 bytes
1261 bytes
"Uri" <Uri@MyMail.com> wrote in message
news:4534d31d$1@newsgroups.borland.com...
> void OnDeviceChange(Messages::TMessage );
Just an FYI, in a message map, you need to pass TMessage by reference, not
by value, just like when overriding WndProc():
void __fastcall OnDeviceChange(Messages::TMessage &);
Gambit
Re: OnDeviceChange Problem
Author: Uri
Date: Wed, 18 Oct 2006 12:41
Date: Wed, 18 Oct 2006 12:41
35 lines
1739 bytes
1739 bytes
No, it's not working either.... when I insert or remove my USB
device the 'WMDiskChange' function is call several times but at
each call I see in the debuger that Message.WParam = 7, when I
insert, or when I remove the USB connector of the device.
Any idea why? can it be a problem in the device itself?
Here is my last code -
void __fastcall WMDiskChange( TMessage &Message );
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER( WM_DEVICECHANGE, TMessage, WMDiskChange )
END_MESSAGE_MAP( TControl )
void __fastcall TForm1::WMDiskChange( TMessage &Message )
{
int Value;
Value = Message.WParam;
Value = Value; // I set my breakpoint here
}
>Just an FYI, in a message map, you need to pass TMessage by reference, not
>by value, just like when overriding WndProc():
>
> void __fastcall OnDeviceChange(Messages::TMessage &);
>
>
>Gambit
Re: OnDeviceChange Problem
Author: Uri
Date: Wed, 18 Oct 2006 12:48
Date: Wed, 18 Oct 2006 12:48
12 lines
1335 bytes
1335 bytes
>Just a thought: >It could be that the mystery device you are unplugging isn't supposed >to report device arrival/removed. You might ask the manufacturer. How can the device send 'removed' report when I remove it? I mean, when I remove it, I disconnect the USB cable, so the device can't send anything becouse the cable is not connected any more to the PC..... am I wrong? Uri.
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Wed, 18 Oct 2006 13:14
Date: Wed, 18 Oct 2006 13:14
20 lines
1550 bytes
1550 bytes
Uri wrote: > No, it's not working either.... Have a look at RegisterDeviceNotification() in MSDN. It seems to be the correct way to do what you want. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/registering_for_device_notification.asp or http://tinyurl.com/w9h6w Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: OnDeviceChange Problem
Author: Uri
Date: Wed, 18 Oct 2006 13:44
Date: Wed, 18 Oct 2006 13:44
26 lines
1551 bytes
1551 bytes
>Have a look at RegisterDeviceNotification() in MSDN. It seems to be the >correct way to do what you want. > >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/registering_for_device_notification.asp > >or > >http://tinyurl.com/w9h6w > >Michel Hi, I did not understand how to use it... from where do I call to this function? what is the 'GUID InterfaceClassGuid' parameter from where do I take it? Where exactly 'hWnd' get it's value? Where do I find the defenition of DEV_BROADCAST_DEVICEINTERFACE ? Which paarmeter shows me if the device was Inserted or Removed ? Thanks.
Re: OnDeviceChange Problem
Author: Uri
Date: Wed, 18 Oct 2006 14:20
Date: Wed, 18 Oct 2006 14:20
24 lines
1783 bytes
1783 bytes
I tried the following, 'NotificationFilter' data looks exactly
the same for 'Insert' or 'Remove'.
also, I did not know from where to take
'NotificationFilter.dbcc_classguid' data.
Thanks.
void __fastcall TForm1::WMDiskChange( TMessage &Message )
{
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
char szMsg[80];
ZeroMemory( &NotificationFilter, sizeof( NotificationFilter ) );
NotificationFilter.dbcc_size = sizeof( DEV_BROADCAST_DEVICEINTERFACE );
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
//NotificationFilter.dbcc_classguid = InterfaceClassGuid; // ? ? ? ? ?
RegisterDeviceNotification( Application->Handle, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE );
}
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Wed, 18 Oct 2006 15:08
Date: Wed, 18 Oct 2006 15:08
18 lines
1625 bytes
1625 bytes
Uri wrote: > Hi, I did not understand how to use it. Sorry, I don't know either. I just did a search on MSDN and they mention that function in their article about Device Events. That's all I know about it. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/device_events.asp Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Wed, 18 Oct 2006 15:15
Date: Wed, 18 Oct 2006 15:15
21 lines
1622 bytes
1622 bytes
Uri wrote: > what is the 'GUID InterfaceClassGuid' parameter from where do I > take it? Seems you can found it here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/setup-cls_f7544122-69a3-4b34-85f5-db3714408026.xml.asp > > Where exactly 'hWnd' get it's value? That's the handle of *your* window receiving notification. Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: OnDeviceChange Problem
Author: Remy Lebeau (TeamB)
Date: Wed, 18 Oct 2006 16:45
Date: Wed, 18 Oct 2006 16:45
15 lines
1519 bytes
1519 bytes
"Uri" <Uri@nomail.com> wrote in message news:453622af$1@newsgroups.borland.com... > How can the device send 'removed' report when I remove it? > I mean, when I remove it, I disconnect the USB cable, so the > device can't send anything becouse the cable is not connected > any more to the PC..... am I wrong? The device itself is not the one sending the notifications. The OS is, in response to the device driver reporting that the device is attached/detached. Gambit
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Wed, 18 Oct 2006 17:46
Date: Wed, 18 Oct 2006 17:46
47 lines
2510 bytes
2510 bytes
Uri wrote:
> Hi, I did not understand how to use it.
Ok, I tried with my usb key and it works.
RegisterDeviceNotification() tells the OS to send to your app the
notification messages you want. Without this as you've noted, you don't
receive the arrival or removal of your device.
First add this to your form constructor:
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter = {0};
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
NotificationFilter.dbcc_classguid = GUID_DEVCLASS_USB;
RegisterDeviceNotification(Handle,
&NotificationFilter,
DEVICE_NOTIFY_WINDOW_HANDLE);
And then in your message handler (WndProc or whatever):
if(Message.Msg == WM_DEVICECHANGE)
{
switch(Message.WParam)
{
case DBT_DEVICEARRIVAL:
Application->MessageBox("Arrival","USB",MB_OK);
break;
case DBT_DEVICEREMOVECOMPLETE:
Application->MessageBox("Removal","USB",MB_OK);
break;
}
}
Don't know if it works for any USB devices but at least it works for my
usb key.
HTH
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Wed, 18 Oct 2006 18:29
Date: Wed, 18 Oct 2006 18:29
18 lines
1582 bytes
1582 bytes
Michel Leunen wrote: > First add this to your form constructor: [snip] I forgot to mention that you have to include: #include <dbt.h> #include <devguid.h> Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: OnDeviceChange Problem
Author: Uri
Date: Thu, 19 Oct 2006 08:02
Date: Thu, 19 Oct 2006 08:02
21 lines
1466 bytes
1466 bytes
From where do I take the defenition for 'GUID_DEVCLASS_USB' ? I get this error message: Undefined symbol 'GUID_DEVCLASS_USB'. I have - #include <windows.h> #include <dbt.h> // for DEV_BROADCAST_DEVICEINTERFACE #include <initguid.h> // defines the guid macros >I forgot to mention that you have to include: > >#include <dbt.h> >#include <devguid.h> > >Michel
Re: OnDeviceChange Problem
Author: Uri
Date: Thu, 19 Oct 2006 08:16
Date: Thu, 19 Oct 2006 08:16
50 lines
6079 bytes
6079 bytes
Hi, I have found the file 'devguid.h' on my PC, in this file I find the following Guids, which one is the Guid of my device? (the device is just a small Electronic Card that someone has made for us) also, after I know which GUID is the one that I need, how do I write it in the command? can you pleaseshow me an example? Thanks, and here is what I see in my file - DEFINE_GUID( GUID_DEVCLASS_1394, 0x6bdd1fc1L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f ); DEFINE_GUID( GUID_DEVCLASS_ADAPTER, 0x4d36e964L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_CDROM, 0x4d36e965L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_COMPUTER, 0x4d36e966L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_DECODER, 0x6bdd1fc2L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f ); DEFINE_GUID( GUID_DEVCLASS_DISKDRIVE, 0x4d36e967L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_DISPLAY, 0x4d36e968L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_FDC, 0x4d36e969L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_GPS, 0x6bdd1fc3L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f ); DEFINE_GUID( GUID_DEVCLASS_HDC, 0x4d36e96aL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_IMAGE, 0x6bdd1fc4L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f ); DEFINE_GUID( GUID_DEVCLASS_INFRARED, 0x6bdd1fc5L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f ); DEFINE_GUID( GUID_DEVCLASS_KEYBOARD, 0x4d36e96bL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_LEGACYDRIVER, 0x8ecc055dL, 0x047f, 0x11d1, 0xa5, 0x37, 0x00, 0x00, 0xf8, 0x75, 0x3e, 0xd1 ); DEFINE_GUID( GUID_DEVCLASS_MEDIA, 0x4d36e96cL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_MODEM, 0x4d36e96dL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_MONITOR, 0x4d36e96eL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_MOUSE, 0x4d36e96fL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_MTD, 0x4d36e970L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_MULTIFUNCTION, 0x4d36e971L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_NET, 0x4d36e972L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_NETCLIENT, 0x4d36e973L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_NETSERVICE, 0x4d36e974L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_NETTRANS, 0x4d36e975L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_NODRIVER, 0x4d36e976L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_PARALLEL, 0x811fc6a5L, 0xf728, 0x11d0, 0xa5, 0x37, 0x00, 0x00, 0xf8, 0x75, 0x3e, 0xd1 ); DEFINE_GUID( GUID_DEVCLASS_PCMCIA, 0x4d36e977L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_PORTS, 0x4d36e978L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_PRINTER, 0x4d36e979L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_PRINTERUPGRADE, 0x4d36e97aL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_SCSIADAPTER, 0x4d36e97bL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_SOUND, 0x4d36e97cL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_STILLIMAGE, 0x6bdd1fc6L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f ); DEFINE_GUID( GUID_DEVCLASS_SYSTEM, 0x4d36e97dL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_TAPEDRIVE, 0x6d807884L, 0x7d21, 0x11cf, 0x80, 0x1c, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_UNKNOWN, 0x4d36e97eL, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 ); DEFINE_GUID( GUID_DEVCLASS_VOLUME, 0x71a27cddL, 0x812a, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f ); Thanks.
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Thu, 19 Oct 2006 08:20
Date: Thu, 19 Oct 2006 08:20
26 lines
1939 bytes
1939 bytes
Uri wrote: > From where do I take the defenition for 'GUID_DEVCLASS_USB' ? Hmm, re-read my post :-) *You* have: > #include <windows.h> > #include <dbt.h> // for DEV_BROADCAST_DEVICEINTERFACE > #include <initguid.h> // defines the guid macros And *I* wrote: >> I forgot to mention that you have to include: >> >> #include <dbt.h> >> #include <devguid.h> Do you see the #include <devguid.h>? Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Thu, 19 Oct 2006 08:33
Date: Thu, 19 Oct 2006 08:33
23 lines
1952 bytes
1952 bytes
Uri wrote: > Hi, > > I have found the file 'devguid.h' on my PC, in this file I find > the following Guids, It seems that there are a lot more GUIDs in my version of the file than yours. Weird. Which version of BCB are you using? > which one is the Guid of my device? (the > device is just a small Electronic Card that someone has made for > us) I don't know. Ask the manufacturer. Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: OnDeviceChange Problem
Author: Uri
Date: Thu, 19 Oct 2006 09:14
Date: Thu, 19 Oct 2006 09:14
40 lines
2118 bytes
2118 bytes
I work with Builder 4.0 Now I have all the following includes: #include <windows.h> #include <dbt.h> // for DEV_BROADCAST_DEVICEINTERFACE #include <initguid.h> // defines the guid macros #include <devguid.h>? but I still get the Error message - Undefined symbol 'GUID_DEVCLASS_USB' on the line - NotificationFilter.dbcc_classguid = GUID_DEVCLASS_USB; Do you have any Idea why ? Michel Leunen <nospam@noreply.be> wrote: >Uri wrote: >> Hi, >> >> I have found the file 'devguid.h' on my PC, in this file I find >> the following Guids, > >It seems that there are a lot more GUIDs in my version of the file than >yours. Weird. Which version of BCB are you using? > >> which one is the Guid of my device? (the >> device is just a small Electronic Card that someone has made for >> us) > >I don't know. Ask the manufacturer. > >Michel
Re: OnDeviceChange Problem
Author: Michel Leunen
Date: Thu, 19 Oct 2006 09:38
Date: Thu, 19 Oct 2006 09:38
25 lines
1982 bytes
1982 bytes
Uri wrote:
> I work with Builder 4.0
Your header includes probably les classes then a more recent one.
> Undefined symbol 'GUID_DEVCLASS_USB'
Here is how it is defined in mine:
DEFINE_GUID( GUID_DEVCLASS_USB, 0x36fc9e60L, 0xc465,
0x11cf, 0x80, 0x56, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 );
You can define it like this in your code:
GUID GUID_DEVCLASS_USB = {0x36fc9e60, 0xc465, 0x11cf, {0x80, 0x56,
0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads