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;
do
{
keepLooping = ReadFile( inFileHandler, inbuf, (uint)inbuf.Length, ref
numReadWrite, ref overlap );
if( keepLooping )
mrh( ByteArrayToString( inbuf ) );
}while( keepLooping );
}

Thanks,

Tim.

Re: bluetooth connection between windows ce devices by Chris

Chris
Mon Jan 26 05:30:33 CST 2004

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
www.opennetcf.org/serial.asp

-Chris

"Tim" <smash_be@hotmail.com> wrote in message
news:bv2njr$7ch$1@naxos.belnet.be...
> 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;
> do
> {
> keepLooping = ReadFile( inFileHandler, inbuf, (uint)inbuf.Length, ref
> numReadWrite, ref overlap );
> if( keepLooping )
> mrh( ByteArrayToString( inbuf ) );
> }while( keepLooping );
> }
>
> Thanks,
>
> Tim.
>
>