program ErrUser;
uses PXEngine, WinCrt;

const TableName = 'Table';
      NetDir    = '';

var   PxErr: Integer;
      TblHandle: TableHandle;
      UserName: Array[0..24] of char;

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

begin
  PX(PXWinInit('MyApp', pxShared));
  PX(PXTblOpen(TableName, TblHandle, 0, False));

  (* Determine which user is causing a locking error *)
  PxErr := PXNetErrUser(20, @userName);
  if PxErr <> PxSuccess then
    Writeln(PxErrMsg(PxErr))
  else Writeln('The user causing the network error is ', UserName);

  PX(PXTblClose(TblHandle));
  PX(PXExit);
end.
