2011. február 21., hétfő

How to get a list of all current users from the BDE


Problem/Question/Abstract:

Is it possible to get a list of all current users from the BDE? If I try to overwrite a file the BDE will tell me who is using it, one at a time. It would be quicker if I could get a complete list.

Answer:

With Paradox, yes:

procedure BDEGetPDXUserList(AList: TStrings);
var
  hCur: hDBICur;
  UDesc: USERDesc;
begin
  AList.Clear;
  Check(DBIOpenUserList(hCur));
  try
    while DBIGetNextRecord(hCur, dbiNOLOCK, @UDesc, nil) <> DBIERR_EOF do
    begin
      AList.Add(StrPas(UDesc.szUserName));
    end;
  finally
    DBICloseCursor(hCur);
  end;
end;

Nincsenek megjegyzések:

Megjegyzés küldése