Bluetooth Virtual COM Ports

The Windows CE Bluetooth stack has the capability to expose a COM port interface to applications.  This allows legacy applications that communicate over serial ports to use the Bluetooth Serial Port Profile.  Common applications of this include GPS and printing.


On Windows Mobile 5.0, we now provide user interface to configure BT virtual COM ports.  Devices based on WM2003 might have had UI supplied by the OEM to do this.  A user can now pair with a GPS device or printer, create a BT COM port from the UI, and configure their applicaton to use that port.  In this blog entry I'll talk about how to programmatically set up virtual COM ports.


To create a virtual COM port you need to use the RegisterDevice API.  The following code will register the COM port at the specified index to Bluetooth.


PORTEMUPortParams pp;
memset(&pp, 0, sizeof(pp));
pp.device = ba; = channel & 0xff;


HANDLE h = RegisterDevice(L"COM", index, L"btd.dll", (DWORD)&pp);


There are two flavors of BT COM ports: client & server ports.  A server port sets pp.flocal to TRUE and does not specify a BT address in pp.device.  The purpose of server ports is to wait for incoming connections on the specified RFCOMM channel.  The above code creates a client port.  When an application calls CreateFile, the BT stack will connect to the remote device specified in pp.device.  It will disconnect on CloseHandle.


A client port can specify pp.uuidService instead of  This will tell the BT stack to find the RFCOMM channel on the remote device based on the SDP service UUID.


For more info on BT COM port emulation:


For more info on the PORTEMUPortParams structure:


For applications that are aware they are using Bluetooth, it is recommended that developers use winsock APIs.  The purpose of BT virtual COM ports is to enable legacy applications to use Bluetooth.


For more info on using BT winsock APIs:


[Author: Greg Scott]


Comments (3)

  1. Nino.Mobile says:

     Expansys now has the Qtek 9100 available for pre-order.  I hear that Mad Monkey Boy’s Gadgets may…

  2. Nino.Mobile says:

     Expansys now has the Qtek 9100 available for pre-order.  Keep an eye on  Mad Monkey Boy’s…

  3. keith says:

    smart devices in the UK have the Qtek 9100 in stock

Skip to main content