Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];


And you can block access to the folder, something like fmShareExclusive, but for the folder ??? Find similar branches

Art   (2001-12-18 15:12) [0]

And you can block access to the folder, something like fmShareExclusive, but for the folder ???

Алексей Петров   (2001-12-18 16:08) [1]

Using CreateFile, you can open a directory, incl. and exclusive.

Try it ...

Details in MSDN

cdaDmitriy   (2001-12-18 17:20) [2]

> Alexey Petrov ©
SOURCE for use CreateFile for
With CreateFile can I open a directory? ...

Алексей Петров   (2001-12-18 17:23) [3]

> cdaDmitriy © (18.12.01 17: 20)
Read MSDN.
Source I in trivial cases do not cite.

Art   (2001-12-18 17:25) [4]

I will definitely try, but from the words MSDN breathes something melkosoftovym, and I'm talking about Delphi !!

cdaDmitriy   (2001-12-18 17:40) [5]

> Alexey Petrov © I do not cite in trivial cases?
I tried ... try to give an example.

cdaDmitriy   (2001-12-18 17:47) [6]

S1: = "D: \ ICON \"; including and exclusive
H: = Integer (CreateFile (PChar (S1), GENERIC_READ, 0 , nil, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
label1.Caption: = inttostr (H);
if H <0 then raise EFCreateError.CreateResFmt (@S, [S1]);

Art   (2001-12-18 17:53) [7]

cdaDmitriy from UTD you got it, I have no doubt in the performance of the code, but the hunt to read about the directories

cdaDmitriy   (2001-12-18 17:59) [8]

help for CreateFile and tried

Art   (2001-12-18 20:24) [9]

You guys or fools or do not know how to read. It was asked a question to lock the folder, access to it. And you about the files to me ??? At first I did not believe it, but then I found out everything, everything written here, except for my question, is nonsense!

Anatoly Podgoretsky   (2001-12-18 20:28) [10]

Yes, and what do you think will answer you in the future, I do not want to check the code above, but the next folder hint the same file.

Art   (2001-12-18 21:39) [11]

“Natholii, then I am a fool !!! ? everyone is here!!! џ I tried the code above and wrote it myself and did not go through anything, if you specify a directory, nothing changes, and if the file is all, then everything works, the file is locked !!! ? How to deal with this ???

Алексей Петров   (2001-12-19 08:41) [12]

Another hint:
In the code given by "cdaDmitriy © (18.12.01 17: 47)" 2 errors.
1. In the directory name, the final "\" is superfluous.
2. The check whether the file is opened should be performed by checking for INVALID_HANDLE_VALUE, not <0. In the current version of Delphi and WinAPI Integer (INVALID_HANDLE_VALUE) of course <0, but this can change, and it is theoretically possible that a correct Handle can appear, such that Integer (Handle) <0.
3. To check WinAPI errors, it is more convenient to write

> Art © (18.12.01 17: 25)
If MSDN is confused - see the help in the SDK, this is the actual truncated version of MSDN. And from Delphi, all APIs are beautifully invoked.

cdaDmitriy   (2001-12-19 09:31) [13]

> Alexey Petrov ©

1. In the directory name, the final "\" is superfluous.
it is not superfluous but redundant:


Points to a null-terminated string that can be used to create or open.

If * lpFileName is a path, there is a default string size limit of MAX_PATH characters. This function is parses paths.
Windows NT: You can use the paths of the CreateFile and Prepending "\\? \" To the path. The "\\? \" Tells the function to turn off path parsing. 32,000 Unicode characters long. You must use the fully qualified paths with this technique. This also works with UNC names. The "\\? \" Is ignored as part of the path. For example, "\\? \ C: \ myworld \ private" is seen as "C: \ myworld \ private", and "\\? \ UNC \ tom_1 \ hotstuff \ coolapps" is seen as "\\ tom_1 \ hotstuff \ coolapps. "

2. see the implementation of unit Classes; although
Win32Check (H <> INVALID_HANDLE_VALUE) is more reliable.


constructor TFileStream.Create (const FileName: string; Mode: Word);
if Mode = fmCreate then
FHandle: = FileCreate (FileName);
if FHandle <0 then
raise EFCreateError.CreateResFmt (@SFCreateError, [FileName]);
end else
FHandle: = FileOpen (FileName, Mode);
if FHandle <0 then
raise EFOpenError.CreateResFmt (@SFOpenError, [FileName]);

Art © everything works if you want to write send

Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];


Memory: 0.59 MB
Time: 0.027 c
2001-09-21 10:31
Do I have a Celeron 800 worth upgrading to the Pentium III 800?

Romualds stashans
2001-12-18 11:07
How can Delphi run * .exe with ....

2001-12-17 19:45
How to put your line in the current edit?

2001-12-19 19:08
Does anyone have a thread hash MD5?

2001-11-06 11:00
How to get an icon for a registered extension in the system

afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic Indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Spanish swahili Swedish Thai turkish Ukrainian urdu Vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada Khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
English French German Italian Portuguese Russian Spanish