Hi.
I am not exactly using C++ but using native/PInvoke calls from C#. I believe this would be more appropriate forum in asking this question.
I have an MDA Vario with WM5.
I am having trouble with trying to send data/set comm state to COM4. PLEASE help.
I can get a VALID handle using CreateFile, no sharing, write only
Firstly, I need to GetCommState so I can set the baud rate etc...
I create a DCB and then:
int result = GetCommState(theComHandle, theDCB);
At this point, I always get error 12: ERROR_INVALID_ACCESS
If I try to SetCommState or even EscapeCommFunction(theComHandle, CLRIR) I also get this error too.
I dont understand why What am I doing wrong
I want to do this:
Open COM4 (IrCOMM/RAW IR)
Set baud rate
Send data
Close

COM issues
SMap
RJR
Tayfun Kocak
I think I am getting a step closer but still require help.
I can now create a more successful handle:
CreateFile("COM4:", GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
I can also now SetupComm(theHandle, 255, 255)
I can now even get further as setting up GetCommState(theHandle, DCB) but here the value returned is 1 (success) but error 6 = ERROR_INVALID_HANDLE
ignoring the error, I can SetCommState but only if I dont modify the dcb and keep the value returned from GetCommState. Still get error 6.
what am I doing wrong
Sergio Arizmendi
ill take a look but im afraid it is a hardware (really driver) limitation.
I give up on some handset manufacturers (*cough* HTC *cough*)
When I use this...
IntPtr thandle = CreateFile("COM4:", GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
I get a valid handle back however the lasterror gives me error 50 - ERROR_NOT_SUPPORTED
this happens on:
SPV C500 (5600SMT I believe)
Imate SP5m
MDA Vario PPC
devices
SHOAIB AHMED
Matt Snyder
Jordan Sparks
I did not understand why are you telling to read your tutorial.
RMJR
Kevin ORiordan
Try some of the things mentioned here:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=300214&SiteID=1
I find OPEN_ALWAYS is better then OPEN_EXISTING