X xxlqust Unregistered / Unconfirmed GUEST, unregistred user! 2006-06-19 #1 在delphi中如何使用ReadFile函数!<br>谢谢各位了!
L lmxcyx Unregistered / Unconfirmed GUEST, unregistred user! 2006-06-19 #3 var<br> hwd:THandle;<br> FileName:String;<br> bufferChar;<br> ReadWord;<br>begin<br>if OPenDialog1.Execute then<br> begin<br> try<br> FileName:=OpenDialog1.FileName;<br> try<br> hwd:= Createfile(PChar(FileName),GENERIC_READ ,FILE_SHARE_READ ,nil,OPEN_EXISTING,<br> FILE_ATTRIBUTE_READONLY,FILE_FLAG_RANDOM_ACCESS);<br> getMem(buffer,1024);<br> if ReadFile(hwd,buffer,1024,Read,nil) then<br> showmessage('');<br> except<br> CloseHandle(hwd);<br> end;<br> except<br> if hwd=ERROR_ALREADY_EXISTS then<br> exit;<br> end;<br> end;<br>end;
var<br> hwd:THandle;<br> FileName:String;<br> bufferChar;<br> ReadWord;<br>begin<br>if OPenDialog1.Execute then<br> begin<br> try<br> FileName:=OpenDialog1.FileName;<br> try<br> hwd:= Createfile(PChar(FileName),GENERIC_READ ,FILE_SHARE_READ ,nil,OPEN_EXISTING,<br> FILE_ATTRIBUTE_READONLY,FILE_FLAG_RANDOM_ACCESS);<br> getMem(buffer,1024);<br> if ReadFile(hwd,buffer,1024,Read,nil) then<br> showmessage('');<br> except<br> CloseHandle(hwd);<br> end;<br> except<br> if hwd=ERROR_ALREADY_EXISTS then<br> exit;<br> end;<br> end;<br>end;