Hi,
My app registers for device-notifications, in order to get more info about
devices added.

For Disks it's simple to get the devicename (like "Dsk1:") from the
notification.
(through LPARAM I think...)
For PORTS (COM1:) I can only get the device-interface-GUID as far as I can
tell.
(LPARAM=0)
I read on inet that using this info, I need to Enumerate all my devices,
access the active-driver-registry, and determining myself which was added or
removed.
(how ??? by keeping device-lists ? hope not...)

This seems way to complex (error prone,slow), since I think it IS known
which is the devicename is beeing mounted.
How can I get to this info in a simple and straightforward way ?

in short : the goal is to call 2 members from my
devicenotification-interface :
void PortAdded(WCHAR *devname);
void PortRemoved(WCHAR *devname);

Where devname is something like "COM1:"
Any Tips ?

Greetings,
Rob.

Re: Device notifications : port device name by Bruce

Bruce
Tue Jun 10 15:07:11 PDT 2008

Funny, I posted to my blog yesterday a little function that enumerates the
loaded driver.

http://geekswithblogs.net/BruceEitman/archive/2008/06/10/windows-ce-listing-running-drivers.aspx

This just outputs to the debug port, but I bet you can figure out a way to
keep track of them.

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT EuroTech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

EuroTech Inc.
www.EuroTech.com

"Rob" <Rob@discussions.microsoft.com> wrote in message
news:2AA2593C-10A0-4EF0-A8AD-5888939C5EB9@microsoft.com...
> Hi,
> My app registers for device-notifications, in order to get more info about
> devices added.
>
> For Disks it's simple to get the devicename (like "Dsk1:") from the
> notification.
> (through LPARAM I think...)
> For PORTS (COM1:) I can only get the device-interface-GUID as far as I can
> tell.
> (LPARAM=0)
> I read on inet that using this info, I need to Enumerate all my devices,
> access the active-driver-registry, and determining myself which was added
> or
> removed.
> (how ??? by keeping device-lists ? hope not...)
>
> This seems way to complex (error prone,slow), since I think it IS known
> which is the devicename is beeing mounted.
> How can I get to this info in a simple and straightforward way ?
>
> in short : the goal is to call 2 members from my
> devicenotification-interface :
> void PortAdded(WCHAR *devname);
> void PortRemoved(WCHAR *devname);
>
> Where devname is something like "COM1:"
> Any Tips ?
>
> Greetings,
> Rob.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



Re: Device notifications : port device name by Rob

Rob
Wed Jun 11 00:17:00 PDT 2008

Hi ,
Thanks Bruce, that looks usefull.
But it still leaves the problem of how to determine which of those device's
was the one that was just added (or removed).

I would expect that I can determine this in the notification in some way.
Isn't that the main point of notifications ?

Greetings,
Rob.



"Bruce Eitman [eMVP]" wrote:

> Funny, I posted to my blog yesterday a little function that enumerates the
> loaded driver.
>
> http://geekswithblogs.net/BruceEitman/archive/2008/06/10/windows-ce-listing-running-drivers.aspx
>
> This just outputs to the debug port, but I bet you can figure out a way to
> keep track of them.
>
> --
> Bruce Eitman (eMVP)
> Senior Engineer
> Bruce.Eitman AT EuroTech DOT com
> My BLOG http://geekswithblogs.net/bruceeitman
>
> EuroTech Inc.
> www.EuroTech.com
>
> "Rob" <Rob@discussions.microsoft.com> wrote in message
> news:2AA2593C-10A0-4EF0-A8AD-5888939C5EB9@microsoft.com...
> > Hi,
> > My app registers for device-notifications, in order to get more info about
> > devices added.
> >
> > For Disks it's simple to get the devicename (like "Dsk1:") from the
> > notification.
> > (through LPARAM I think...)
> > For PORTS (COM1:) I can only get the device-interface-GUID as far as I can
> > tell.
> > (LPARAM=0)
> > I read on inet that using this info, I need to Enumerate all my devices,
> > access the active-driver-registry, and determining myself which was added
> > or
> > removed.
> > (how ??? by keeping device-lists ? hope not...)
> >
> > This seems way to complex (error prone,slow), since I think it IS known
> > which is the devicename is beeing mounted.
> > How can I get to this info in a simple and straightforward way ?
> >
> > in short : the goal is to call 2 members from my
> > devicenotification-interface :
> > void PortAdded(WCHAR *devname);
> > void PortRemoved(WCHAR *devname);
> >
> > Where devname is something like "COM1:"
> > Any Tips ?
> >
> > Greetings,
> > Rob.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>

Re: Device notifications : port device name by Michel

Michel
Wed Jun 11 04:05:14 PDT 2008

IIRC you can define a GUID in the driver registry entries that gets
passed in the notification structure. Otherwise
GetDeviceInformationByXXXX functions? What function you use for device
notifications?


Good luck,

Michel Verhagen, eMVP
Check out my blog: http://GuruCE.com/blog

GuruCE Ltd.
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.

Rob wrote:
> Hi ,
> Thanks Bruce, that looks usefull.
> But it still leaves the problem of how to determine which of those device's
> was the one that was just added (or removed).
>
> I would expect that I can determine this in the notification in some way.
> Isn't that the main point of notifications ?
>
> Greetings,
> Rob.
>
>
>
> "Bruce Eitman [eMVP]" wrote:
>
>> Funny, I posted to my blog yesterday a little function that enumerates the
>> loaded driver.
>>
>> http://geekswithblogs.net/BruceEitman/archive/2008/06/10/windows-ce-listing-running-drivers.aspx
>>
>> This just outputs to the debug port, but I bet you can figure out a way to
>> keep track of them.
>>
>> --
>> Bruce Eitman (eMVP)
>> Senior Engineer
>> Bruce.Eitman AT EuroTech DOT com
>> My BLOG http://geekswithblogs.net/bruceeitman
>>
>> EuroTech Inc.
>> www.EuroTech.com
>>
>> "Rob" <Rob@discussions.microsoft.com> wrote in message
>> news:2AA2593C-10A0-4EF0-A8AD-5888939C5EB9@microsoft.com...
>>> Hi,
>>> My app registers for device-notifications, in order to get more info about
>>> devices added.
>>>
>>> For Disks it's simple to get the devicename (like "Dsk1:") from the
>>> notification.
>>> (through LPARAM I think...)
>>> For PORTS (COM1:) I can only get the device-interface-GUID as far as I can
>>> tell.
>>> (LPARAM=0)
>>> I read on inet that using this info, I need to Enumerate all my devices,
>>> access the active-driver-registry, and determining myself which was added
>>> or
>>> removed.
>>> (how ??? by keeping device-lists ? hope not...)
>>>
>>> This seems way to complex (error prone,slow), since I think it IS known
>>> which is the devicename is beeing mounted.
>>> How can I get to this info in a simple and straightforward way ?
>>>
>>> in short : the goal is to call 2 members from my
>>> devicenotification-interface :
>>> void PortAdded(WCHAR *devname);
>>> void PortRemoved(WCHAR *devname);
>>>
>>> Where devname is something like "COM1:"
>>> Any Tips ?
>>>
>>> Greetings,
>>> Rob.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>

Re: Device notifications : port device name by Rob

Rob
Wed Jun 11 05:17:01 PDT 2008

Hi Michel,
Sorry, I was confused.
The problem described only occurs in XP, The CE version works OK.

The LParam=0 is the problem in XP.
In XP there is no MSGQ with info...

wrong group ;-)

Greetings,
Rob.



"Michel Verhagen (eMVP)" wrote:

> IIRC you can define a GUID in the driver registry entries that gets
> passed in the notification structure. Otherwise
> GetDeviceInformationByXXXX functions? What function you use for device
> notifications?
>
>
> Good luck,
>
> Michel Verhagen, eMVP
> Check out my blog: http://GuruCE.com/blog
>
> GuruCE Ltd.
> Microsoft Embedded Partner
> http://GuruCE.com
> Consultancy, training and development services.
>
> Rob wrote:
> > Hi ,
> > Thanks Bruce, that looks usefull.
> > But it still leaves the problem of how to determine which of those device's
> > was the one that was just added (or removed).
> >
> > I would expect that I can determine this in the notification in some way.
> > Isn't that the main point of notifications ?
> >
> > Greetings,
> > Rob.
> >
> >
> >
> > "Bruce Eitman [eMVP]" wrote:
> >
> >> Funny, I posted to my blog yesterday a little function that enumerates the
> >> loaded driver.
> >>
> >> http://geekswithblogs.net/BruceEitman/archive/2008/06/10/windows-ce-listing-running-drivers.aspx
> >>
> >> This just outputs to the debug port, but I bet you can figure out a way to
> >> keep track of them.
> >>
> >> --
> >> Bruce Eitman (eMVP)
> >> Senior Engineer
> >> Bruce.Eitman AT EuroTech DOT com
> >> My BLOG http://geekswithblogs.net/bruceeitman
> >>
> >> EuroTech Inc.
> >> www.EuroTech.com
> >>
> >> "Rob" <Rob@discussions.microsoft.com> wrote in message
> >> news:2AA2593C-10A0-4EF0-A8AD-5888939C5EB9@microsoft.com...
> >>> Hi,
> >>> My app registers for device-notifications, in order to get more info about
> >>> devices added.
> >>>
> >>> For Disks it's simple to get the devicename (like "Dsk1:") from the
> >>> notification.
> >>> (through LPARAM I think...)
> >>> For PORTS (COM1:) I can only get the device-interface-GUID as far as I can
> >>> tell.
> >>> (LPARAM=0)
> >>> I read on inet that using this info, I need to Enumerate all my devices,
> >>> access the active-driver-registry, and determining myself which was added
> >>> or
> >>> removed.
> >>> (how ??? by keeping device-lists ? hope not...)
> >>>
> >>> This seems way to complex (error prone,slow), since I think it IS known
> >>> which is the devicename is beeing mounted.
> >>> How can I get to this info in a simple and straightforward way ?
> >>>
> >>> in short : the goal is to call 2 members from my
> >>> devicenotification-interface :
> >>> void PortAdded(WCHAR *devname);
> >>> void PortRemoved(WCHAR *devname);
> >>>
> >>> Where devname is something like "COM1:"
> >>> Any Tips ?
> >>>
> >>> Greetings,
> >>> Rob.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
>