Below are first my main file and then the port write function I have got no errors but i dont know where I am going wrong as the 3 byte protocol still wont send to the serial port!! can anyone help me achieve the impossible and send the three byte protocol??
thanks



/************************************************** *********************

WINMAIN ( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)

************************************************** *********************/

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)



{


hPort = INVALID_HANDLE_VALUE; // Serial port handle
hReadThread = NULL; // Handle to the read thread

unsigned char Bytes[3] = { 255, 1, 127 } ;

lpszDevName = TEXT("COM1:");

// Initialize the port.
if (!PortInitialize (lpszDevName))
{
return 0 ;
}


PortWrite(Bytes) ;

PortClose(hPort) ;


return 0 ;

}



/************************************************** *********************

PortWrite (BYTE Byte)

************************************************** *********************/
void PortWrite (unsigned char *Bytes)
{
DWORD dwError,
dwNumBytesWritten;


if (!WriteFile (hPort, // Port handle
&Bytes, // Pointer to the data to write
3, // Number of bytes to write
&dwNumBytesWritten, // Pointer to the number of bytes
// written
NULL)) // Must be NULL for Windows CE
{
// WriteFile failed. Report error.
dwError = GetLastError ();
}
}