G
Guest
Hi there,
SetCommState fail to work in C#, i keep gettting the error of 87, invalid
parameter.
I use this GetLastError to get the value 87.
There is a difference between GetLastError and GetLastWin32Error
Marshal.GetLastWin32Error - returns 0 (means fail to open)
[DllImport("kernel32.dll")]
internal static extern uint GetLastError(); - returns 87 (invalid parameter)
But i did the same thing for SetCommState
[DllImport("kernel32.dll")]
internal static extern bool SetCommState(IntPtr hFile, [In] ref Dcb lpDcb);
Wonder why it fails? GetCommState and others works pretty fine!
I had updated the Dcb structures values when i debug it, and past into the
functions, and it dies off! Why?
C programming works fine not C#.
Any help? Thanks.
SetCommState fail to work in C#, i keep gettting the error of 87, invalid
parameter.
I use this GetLastError to get the value 87.
There is a difference between GetLastError and GetLastWin32Error
Marshal.GetLastWin32Error - returns 0 (means fail to open)
[DllImport("kernel32.dll")]
internal static extern uint GetLastError(); - returns 87 (invalid parameter)
But i did the same thing for SetCommState
[DllImport("kernel32.dll")]
internal static extern bool SetCommState(IntPtr hFile, [In] ref Dcb lpDcb);
Wonder why it fails? GetCommState and others works pretty fine!
I had updated the Dcb structures values when i debug it, and past into the
functions, and it dies off! Why?
C programming works fine not C#.
Any help? Thanks.