PC Review


Reply
Thread Tools Rate Thread

Corrupt strings from GetPortnames()

 
 
Ole
Guest
Posts: n/a
 
      27th Nov 2007
I'm facing a problem like a lot of others during the last few years and
Microsoft doesn't seem to care about it :-(
The problem (one of them) is with the Microsoft bluetooth stack that saves
the virtual com ports without the 0 terminating char in the registry. That
causes the SerialPort.GetPortNames() to return garbage strings for the
bluetooth ports.

Well, Googling around the Net didn't help much - I'm simply not able to
find a workaround solution, so I'll pop the question here: Anyone found a
solution?

Thanks for all your help,
Ole


 
Reply With Quote
 
 
 
 
Ben Voigt [C++ MVP]
Guest
Posts: n/a
 
      29th Nov 2007

"Ole" <(E-Mail Removed)> wrote in message
news:%23$%(E-Mail Removed)...
> I'm facing a problem like a lot of others during the last few years and
> Microsoft doesn't seem to care about it :-(
> The problem (one of them) is with the Microsoft bluetooth stack that saves
> the virtual com ports without the 0 terminating char in the registry. That
> causes the SerialPort.GetPortNames() to return garbage strings for the
> bluetooth ports.
>
> Well, Googling around the Net didn't help much - I'm simply not able to
> find a workaround solution, so I'll pop the question here: Anyone found a
> solution?


My method works with all virtual com ports, although it'd be a bit of work
for you.

Basically, use SetupDi* to enumerate ports from device manager (and
RegisterDeviceNotification if you want to detect hotplug events, like
inserting of a USB bluetooth dongle) and CreateFile to open the device
instance path. If the .NET SerialPort class didn't require all ports to
start with "COM" then you could use it after enumerating yourself, but as it
stands you need a whole new I/O layer.

I highly recommend C++/CLI for the I/O layer, creating an interface usable
from C#.

>
> Thanks for all your help,
> Ole
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SerialPort - GetPortNames Jon Berry Microsoft C# .NET 1 6th Mar 2009 11:50 PM
System.IO.Ports.SerialPort.GetPortNames return wrog names above CO =?Utf-8?B?U2FtQg==?= Microsoft VB .NET 4 9th May 2008 10:45 AM
SerialPort.GetPortNames with Friendly Names =?Utf-8?B?cmZ3Njg=?= Microsoft Dot NET Framework 4 15th Sep 2006 06:45 PM
SerialPort.GetPortNames() returns incorrect port names? =?Utf-8?B?VmlsZQ==?= Microsoft Dot NET Framework 4 5th Jul 2006 04:51 PM
System.IO.Ports.SerialPort.GetPortNames() returns unapplicable values Johannes Bialek Microsoft Dot NET Compact Framework 2 25th Dec 2005 10:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:44 PM.