Tech Support > Microsoft Windows > Development Resources > Creating a virtual COM
Creating a virtual COM
Posted by Omar on January 11th, 2006


Is it possible to create a virtual COM for a device using Microsoft stack?
Is it possible to determine the related number (COM no.)?

Thanks!


Posted by JustBoo on January 11th, 2006


On Wed, 11 Jan 2006 11:59:38 +0100, "Omar"
<ocostantin_NOSPAM_@texa.it> wrote:

I don't quite understand the statement. In this context to me virtual
could mean different things.

IIRC, you're always given a handle/pointer to the COM object by some
COM class factory type function or interface. But I suppose it could
be done. That's if I am even close to understanding your question.

Like Johnny Five: "I need more input." :-) Perhaps post some code or a
more indepth explanation.

Posted by David Jones on January 12th, 2006


JustBoo wrote:
I think the OP means "COM" as in "communications port" (e.g., COM1).
Still, I have no idea what the answer to the OP's question is, and
I agree that it could use a little clarification into exactly what
the OP is trying to accomplish.

David

Posted by Omar on January 12th, 2006


"David Jones" <ncic@tadmas.com> ha scritto nel messaggio
news:S1hxf.53609$ih5.34609@dukeread11...
Sorry for my bad explanation...
I need to open a virtual serial communication port (e.g. COM1) for a device
using Bluetooth (basing my application on Microsoft stack). I've already
realized a C++ application that opens many virtual communcation ports for
several devices using Widcomm stack.
How can I use Microsoft stack to open virtual serial communication ports?
The target operating system is Windows XP Professional SP2.
Thanks...



Posted by JustBoo on January 12th, 2006


On Thu, 12 Jan 2006 08:26:20 +0100, "Omar"
<ocostantin_NOSPAM_@texa.it> wrote:
Doh! I thought you meant Component Object Model. :-)

Search MSDN with this search term (with quotes):

"Serial Communications in Win32"

I'm still not sure about the "stack" thing. Do you mean TCP stack?
That would be Sockets.

Try "DCB" == Device Contol Block. That's the way I've done serial comm
in Windows.

From MSDN:
"The DCB structure defines the control setting for a serial
communications device."
That's how you would get (and set) the port number.

Good Luck.

Posted by David Jones on January 13th, 2006


Omar wrote:

CreateFile("COM1", GENERIC_WRITE | GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);

ReadFile/WriteFile to do I/O, then CloseHandle when done.

HTH,

David

Posted by Omar on January 13th, 2006



"JustBoo" <JustBoo@BooWho.com> ha scritto nel messaggio
news:8upcs1d7vvc5v8t1d0ddr5lij416v48jgg@4ax.com...

I have to "link" the virtual serial communication port to a specific device
via Bluetooth.
Using Widcomm Bluetooth stack I can look for devices and services and create
the link between a COM port and a device.
For example, I can create a "link" between COM7 and the serial port service
of a specific device.
Now I have to do the same using Microsoft Bluetooth stack...
I can create a virtual serial communication port and "link" it to a device
manually.
In my C++ application, I can open this virtual serial communication port
using CreateFile.
The problem is that I can't create and link the virtual serial communication
port via C++ code.
Can you (...both of you) help me?
Thanks...



Posted by JustBoo on January 13th, 2006


On Fri, 13 Jan 2006 09:00:14 +0100, "Omar"
<ocostantin_NOSPAM_@texa.it> wrote:

Sorry, I don't know the Widcomm product at all. Can they give you
support?

You write about the Widcomm bluetooth stack. What creates this stack?

<wild assumption>
I would think there would be a library or *some kind* of
programmatic interface to their product. That is, a set of functions
or objects in C or C++ (even VB or the COM I was talking about)
that you use to "get at" the functionality of their product. If you
are expected to do this without said library / interface then it is
a very, umm, unique product indeed.

Something like:
bool ConnectDevice( int deviceID, int commPortNbr );
</wild assumption>

Do you have something like this?