You should note that the lpBuffer parameter of WriteFile is a LPCVOID (typedef for const void *).
That means the lpBuffer parameter is type-agnostic. You could make it point to an array of chars, or you can make it point to an array of WCHARs, an array of ints, array of doubles, array of Matrices, array of FileSystems, array of... you get the idea. The key to telling WriteFile what the data type is, is through the nNumberofBytesToWrite parameter.
If you want to write 2 WCHARs to the stream, the 3rd parameter to WriteFile should be 2*sizeof(WCHAR) (but make sure that the 2 WCHARs are next to each other in memory).
Note, that sending UNICODE across the serial port is only useful if the program on the other side of the port understands UNICODE.
// WriteFile(f, data, lstrlen(data) * sizeof(TCHAR), &bytesWritten, NULL); // RIGHT
Till now you only know that the printer won't print what you expected. It would be useful to know what number(s) really comes out of the palmtop instead.
EMG
Last edited by Enrico Maria Giordano on Tue Feb 20, 2007 10:54 am, edited 1 time in total.