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

Down

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
Win32Check (H <> INVALID_HANDLE_VALUE)

> 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:

lpFileName

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.


{TFileStream}

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

Art © everything works if you want to write send



Pages: 1 whole branch

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

Top









Memory: 0.6 MB
Time: 0.027 c
1-22211
uuuu
2001-12-13 22:46
2002.01.08
Good evening, day, morning. People help !!! how to dial a number, switch to tone mode, and enter a random code *


14-22370
Zergg
2001-11-08 16:30
2002.01.08
About static DLL loading from CBuilder


14-22361
Nikolay
2001-11-08 00:17
2002.01.08
Yes...............................


3-21907
RDA
2001-12-01 12:48
2002.01.08
Delphi and MySql


3-21906
Yuri Zhukov
2001-11-21 09:40
2002.01.08
Oracle ADO vs DOA - fido7.ru.delphi.db





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 Español 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
zulu
English French German Italian Portuguese Russian Spanish