阅读:1496回复:0
串口驱动问题……
首先声明我用的是Delphi。
问题1:用SPCOMM控件无法传输$13字符,为什么 问题2:一怒之下,我自己用API写串口读写程序,结果使用WriteFile函数时总是不能成功,错误事件报告为“非法或无效的参数”(87号事件),下面是我的部分程序: var Buf:PChar; NumToWrite,NumWritten:LongWord; LastError:DWORD; begin Buf:=PChar(Edit1.Text); NumToWrite:=1; NumWritten:=1; if hcom<>INVALID_HANDLE_VALUE then Begin if not WriteFile(hCom,Buf[1],NumToWrite,NumWritten,lpol) then begin LastError := GetLastError; if LastError = ERROR_INVALID_HANDLE then showmessage(\'Invalid handle\'); if LastError <> ERROR_IO_PENDING then begin showmessage(\'Unexpected error\'); end; end; End Else Showmessage(\'Com not Opened Still\'); end; 哪位高手能帮忙解决一下?多谢了!!! 我的邮箱fightforever@sina.com |
|