Hi, I'm trying to establish with a IPAQ PDA a serial port with a Bluetooth
device with address 00803719C4BB.
If I use COM8 like a normal serial port I establish the communication ok,
it's works, but before it opens a bluetooth window where I choose the device.
Well I want to establish the comm without this selection Window, directly,
and I found in MSDN the following code, in which the handle "h" of
RegisterDevice returns a error number 2.
Anyone knows about using this functions?Please any help will be very
appreciated.
Regards.
CODE:
/////////////////////////////////
PORTEMUPortParams pp;
memset (&pp, 0, sizeof(pp));
pp.device = 0x00803719C4BB; //Address device is placed like this way ??
pp.channel = 2;
pp.flocal = FALSE;
pp.uiportflags = RFCOMM_PORT_FLAGS_REMOTE_DCB;
int puerto= 8;
h = RegisterDevice (L"COM", puerto, L"btd.dll", (DWORD)&pp);
if (h == NULL) {
CString Fallo;
Fallo.Format(_T("Fallo:%d"),GetLastError () ); //RETURNS "2"
}
// Open the port normally like a normal serial port...
CString strPort;
strPort.Format(_T("COM%d:"),puerto);
HandlePort = CreateFile(strPort, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL);
/////////////////////////////////////////////////////