The younger brother only 160 points, give full marks, please feel free to comment!!!!!!
CodePudding user response:
What is your follow-up action?If you need an exclusive operation, add a exception statements should be able to achieve a goal
Try
//the processing of you
Except,
//can't perform processing
end;
CodePudding user response:
Follow-up is to save the word document, so no, you said I add exception statements procedures which placeCodePudding user response:
Follow-up is to save the word document to my databaseCodePudding user response:
In fact, I want to say to a friend on the second floor is the purpose of exception handling statement to find a place to writeCodePudding user response:
Call IsFileInUse, returns False said the file is not open,
The function IsFileInUse (fName: string) : Boolean;
Var
HFileRes: HFILE;
The begin
//http://blog.sina.com.cn/s/blog_4960dbcb0100gofb.html
Result:=false;//the return value is false (that is, the file is not used)
If not FileExists (fName) then the exit;//if the file does not exist the exit
HFileRes:=CreateFile (Pchar (fName), GENERIC_READ or GENERIC_WRITE,
0 {this is the was catnip! }, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
Result:=(HFileRes=INVALID_HANDLE_VALUE);//if CreateFile returns failure, then the Result is true (that is, the file is being used)
If not the Result is then//if the CreateFile function returns success
The CloseHandle (HFileRes);//then close the handle
end;
CodePudding user response:
Don't know what's the news can monitor to theI can think of is the Timer or thread
CodePudding user response:
Help under the roof, can't figure out how to judge the word closeCodePudding user response:
Fifth floor friend idea is very good, is worth reference, but in a program where IsFileInUse function called, if it's not the timerCodePudding user response: