Test open File and read file contents

Source: Internet
Author: User

Unable to copy xxxx: The file is being used by another person or program, in this case how to use QT copy this file, or read out the contents of the file

The file is being used by another person or program, in this case how to use Delphi to copy this file, or directly read the contents of the file?

procedureTform1.button1click (sender:tobject);varF:thandle; Abuffer:Array[0..1024x768] ofbyte; C:integer;beginF:= FileOpen ('C:\Users\kk\Documents\Fichiers outlook\mon fichier de données Outlook (1). pst', FmopenreadorFmsharedenynone); Fillchar (Abuffer, SizeOf (abuffer),0); if(f<>0) and(f<> Invalid_handle_value) Then  beginC:=System.SysUtils.FileRead (F, Abuffer, SizeOf (Abuffer)); ifC=sizeof (Abuffer) ThenShowMessage ('OK')    ElseShowMessage ('fail')  End;End;

Shenzhen JOE was mostly looking for a handle, so he could handle it.
Handle of a file that wants to read all the content easily open
Internal is called CreateFile ZwCreateFile Open file just find the corresponding open file handle just fine

Refer to Special methods:

http://blog.csdn.net/mydo/article/details/3266703

Test open File and read file contents

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.