pitopito
15th November 2012, 16:32
Hi everybody,
I need some help for Serial Port programming (My environment is :Win7 64Bit, QT Creator 2.4.1, QT 4.7.4 32bit).
1) First of all I'd like to know if I can use Windows API's function suc as CreateFile, WriteFile etc in order to write the code.
I tryed to write some lines, using the "CreateFile" function but an error accurs on building : It is not possible to convert from const char[4] to LPCWSTR.
This is the code :
HANDLE hSerial;
hSerial = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if(hSerial==INVALID_HANDLE_VALUE){
if(GetLastError()==ERROR_FILE_NOT_FOUND){
//--code
}
//--some other error occurred. Inform user.
}
2) Is there any other simplier way for programming serial ports in QT?
I looked up in the forum and tried downloading QTserialPort but I can't manage to use it...
Anybody could please help a newbe??? I'm going crazy
Thank you in advance
Giovanni
I need some help for Serial Port programming (My environment is :Win7 64Bit, QT Creator 2.4.1, QT 4.7.4 32bit).
1) First of all I'd like to know if I can use Windows API's function suc as CreateFile, WriteFile etc in order to write the code.
I tryed to write some lines, using the "CreateFile" function but an error accurs on building : It is not possible to convert from const char[4] to LPCWSTR.
This is the code :
HANDLE hSerial;
hSerial = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if(hSerial==INVALID_HANDLE_VALUE){
if(GetLastError()==ERROR_FILE_NOT_FOUND){
//--code
}
//--some other error occurred. Inform user.
}
2) Is there any other simplier way for programming serial ports in QT?
I looked up in the forum and tried downloading QTserialPort but I can't manage to use it...
Anybody could please help a newbe??? I'm going crazy
Thank you in advance
Giovanni