bluetooth connection between windows ce devices



I'm writting a chat program in C# to use between two compaq ipaq's. To
accomplish this, I use 4 functions of coredll.dll to use COM 7 to read and
COM write to read from the bluetooth-connection:
extern static uint CreateFile( string lpFileName, uint dwDesiredAccess, uint
dwShareMode, uint lpSecurityAttributes, uint dwCreationDispostion, uint
dwFlagsAndAttributes, uint hTemplateFile );

extern static bool ReadFile( uint hFile, byte[] lpBuffer, uint
nNumberOfBytesToRead, ref uint lpNumberOfBytesRead, ref uint lpOverlapped );

extern static bool WriteFile( uint hFile, byte[] lpBuffer, uint
nNumberOfBytesToWrite, ref uint lpNumberOfBytesWritten, bool lpOverlapped );

extern static bool CloseHandle( uint hObject );

The problem is, when I write on the one device, I don't receive anything on
the other device. The program won't go past the ReadFile function in the
listen-thread. The function call is like this:

private void ReceiveLoop(){
byte[] inbuf = new byte[5];
uint overlap = 0;
keepLooping = ReadFile( inFileHandler, inbuf, (uint)inbuf.Length, ref
numReadWrite, ref overlap );
if( keepLooping )
mrh( ByteArrayToString( inbuf ) );
}while( keepLooping );





Chris Tacke, eMVP

Assuming that your BT radios have already negotiated to communicate with one
another, I assume you still need to set the comm properties of the port
(speed, etc). You might try using a serial class like the one at


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question