program FileLock;
uses PXEngine, WinCrt;

const FileName = 'Table.DB';

var   PxErr: Integer;

procedure PX(Code : integer);
begin
  writeln(PXErrMsg(Code));
end;

begin
  PX(PXWinInit('MyApp', pxShared));

  (* Lock a file with write-lock *)
  PxErr := PXNetFileLock(FileName, WL);
  if PxErr <> PxSuccess then
    Writeln(PxErrMsg(PxErr))
  else PX(PXNetFileUnlock(FileName, WL));

  PX(PXExit);
end.
