On Thu, 20 Jan 2000 13:08:24 GMT, gilsa_ni...@wanadoo.fr (Groupement
Quote
Informatique du Languedoc) wrote:
> I've many problems in my application with paradox index : they're
>often altered and I get the "Index out of date" message.
> I 've created a complete index regeneration on every table but
>paradox needs exclusive access. But, in many sites, the users are on
>long distant places !
> Please, is somebody know how to get the users list of my paradox
>database ? it will be easier to ask them to quit my application
You can do that with the BDE API functions DbiOpenUsersList and
DbiOpenLockList. The first returns a cursor containing the list of all
users of a Paradox database (i.e., the .NET file). The latter lists all of
the users actively using a particular table.
Following are two custom components (TUserstable and TLockTable) based on
these functions. They are both descendants of TTable, so you can view their
contents using the same properties and methods as a normal table --
including hooking up these components to a TDBGrid through a TDataSource.
To use TUserstable, simply instantiate one of these objects and activate it
(Active property or Open method). To use TLockTable: instantiate an object,
set its TableHandle property to the value in the Handle property of a
TTable, and then activate it. That TTable is the one for which you wish to
view its .LCK file.
unit BDESystem;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, DB, DBTables, BDE;
type
TUserstable = class(TTable)
private
{ Private declarations }
protected
{ Protected declarations }
function CreateHandle: HDBICur; override;
public
{ Public declarations }
published
{ Published declarations }
end;
TLockTable = class(TTable)
private
{ Private declarations }
FTableHandle: HDBICur;
protected
{ Protected declarations }
function CreateHandle: HDBICur; override;
public
{ Public declarations }
property TableHandle: HDBICur read FTableHandle write FTableHandle;
published
{ Published declarations }
end;
implementation
{ TUserstable }
function TUserstable.CreateHandle: HDBICur;
begin
Result := nil;
DbiOpenUserList(Result);
end;
{ TLockTable }
function TLockTable.CreateHandle: HDBICur;
begin
Result := nil;
DbiOpenLockList(TableHandle, True, True, Result);
end;
end.
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski "Health nuts are going to feel stupid someday,
Felton, CA lying in hospitals dying of nothing."
-- Redd Foxx