Best Regards...
Faruk KAYNAKLI
fkay...@yahoo.com
fk1...@bbm.com.tr
you can use the GetConfigParams and ModifyDriver. They´re a TSession´s
methods.
Odilon Araújo
SoftSite Tecnologia
odi...@softsite.com.br
Faruk KAYNAKLI <fkay...@yahoo.com> wrote in message
news:863r5o$fi...@bornews.borland.com...
<<<begin>>>
procedure SetConfigValue(sNode, sItem, sValue: string);
var
hCur: hDBICur;
Config: CFGDesc;
rslt: DBIResult;
temp: array[0..255] of char;
begin
//Open the idapi.cfg and read details for the node given
Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPERSISTENT,
StrPCopy(temp, sNode), hCur));
try
//Go to the top of the node.
Check(DbiSetToBegin(hCur));
//Go thru each leaf in the node until we come to the required item.
repeat
//Don't use check here. We neet the result
rslt := DbiGetNextRecord(hCur, dbiNOLOCK, @Config, nil);
if (rslt = DBIERR_NONE) then begin
if StrPas(Config.szNodeName) = sItem then begin
//Modify the record.
StrPCopy(Config.szValue, sValue);
Check(DbiModifyRecord(hCur, @Config, True));
Break;
end;
end
else //There was an error
if (rslt <> DBIERR_EOF) then
Check(rslt);
until (rslt <> DBIERR_NONE);
finally
//Close the Cursor
if (hCur <> nil) then
Check(DbiCloseCursor(hCur));
end;
end;
<<<end>>>
and setting Local Share with it:
<<<<begin>>>>
Check(dbiInit(nil));
try
// ********* SET THE LOCAL SHARE PROPERTY TO TRUE *********
SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');
finally
Check(dbiExit);
end;
<<<<end>>>>
Gert
>I can change BDE configuration in BDE Administrator. How can I change these
>settings in my program. (for example: Net Dir attribute at
>Configuration\Drivers\Native\Paradox
>or
>Local Share attribute at Configuration\System\Init)
Here is an example for Local Share:
procedure SetLocalShare;
const
InitPath = '\System\Init';
LocalShareDesc = 'LOCAL SHARE';
LocalShareValue = 'TRUE';
var
Cursor: HDbiCur;
ConfigDesc: CfgDesc;
begin
Check(DbiInit(nil));
Check(DbiOpenCfgInfoList(nil, dbiReadWrite, cfgPersistent,
InitPath, Cursor));
try
while DbiGetNextRecord(Cursor, dbiNoLock, @ConfigDesc, nil) =
0 do
begin
if StrIComp(ConfigDesc.szNodeName, LocalShareDesc) = 0 then
begin
if StrIComp(ConfigDesc.szValue, LocalShareValue) <>
0 then
begin
Check(DbiGetRecord(Cursor, dbiWriteLock,
@ConfigDesc, nil));
StrPCopy(ConfigDesc.szValue, LocalShareValue);
Check(DbiModifyRecord(Cursor, @ConfigDesc, True));
end;
end;
end;
finally
DbiCloseCursor(Cursor);
DbiExit;
end;
end;
Note: this will only take effect after you restart your application
*and* after all BDE-using applications are closed.
Net Dir is similar, but can also be set for your application only via
TSession (which is the preferred way, IMHO).
HTH,
Jan
--
Bill
Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)
SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');
I try it with
SetConfigValue('\DRIVERS\NATIVE\PARADOX\', 'NET DIR', 'c:\');
and the error $2208 occurs. Why? Can anybody help me????
I need to change the Net Dir Parameter.
Andreas
Gert Kello wrote:
> > I can change BDE configuration in BDE Administrator. How can I change
> these
> > settings in my program. (for example: Net Dir attribute at
> > Configuration\Drivers\Native\Paradox
> > or
> > Local Share attribute at Configuration\System\Init)
It should be:
SetConfigValue('\DRIVERS\PARADOX', 'NET DIR', 'c:\');
Gert