Delphi Examples: DbiOpenUserList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiOpenUserList

Return to chapter overview

Return a list of users sharing the same network file

The returned list is appended it to the string list object specified in the UserList parameter. This example uses the following input:

 fDbiOpenUserList(ListBox1.Items);

 

The procedure is:

procedure fDbiOpenUserList(UserList: TStrings);

var

 TmpCursor: hDbiCur;

 rslt: dbiResult;

 UsrDesc: USERDesc;

begin

 Check(DbiOpenUserList(TmpCursor));

repeat

   rslt:= DbiGetNextRecord(TmpCursor, dbiNOLOCK, @UsrDesc, nil);

  if (rslt <> DBIERR_EOF) then begin

     UserList.Add('User name: ' + UsrDesc.szUserName);

     UserList.Add('Net Session: ' + IntToStr(UsrDesc.iNetSession));

     UserList.Add('Product Class: ' + IntToStr (UsrDesc.iProductClass));

  end;

until (rslt <> DBIERR_NONE);

 Check(DbiCloseCursor(TmpCursor));

end;