Показать сообщение отдельно

  #5  
Старый 23.04.2009, 12:43
slesh
Познавший АНТИЧАТ
Регистрация: 05.03.2007
Сообщений: 1,985
С нами: 10097606

Репутация: 3349


По умолчанию

ЖЖжете.
The OpenFile function creates, opens, reopens, or deletes a file.

This function is provided for compatibility with 16-bit versions of Windows. In particular, the OpenFile function cannot open a named pipe. Win32-based applications should use the CreateFile function.
OpenFile устаревший аналог CreateFile
GENERIC_WRITE - какраз может послать тебя нах есл ифайл уже открыт монопольно на запись. Так что лучше всего просто напросто свотреть возможность чтения.
И вообще Label - это жесть.
Да и закрывать файл не забывай

Если дело на то пошло то
Код:
program Project1;

{$APPTYPE CONSOLE}

uses
  windows;

var
 h:DWORD;
begin
h:=CreateFile('fsg.exe',GENERIC_READ, FILE_SHARE_READ,nil,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,0);
if h<>dword(-1) then
 begin
  Writeln('OK!');
  CloseHandle(h);
 end else Writeln('ERR!');
readln;
end.
 
Ответить с цитированием