Is there a way to programmatically change a BDE System value (SharedMemSize
and SharedMemLocation) ?
The Delphi Help mentions Session.SaveConfigFile if I add or delete an alias
but nothing about individual system values.
The BDE help (BDE32.hlp) also has no mention.
I'm assuming there is a data structure somewhere which I can alter and save
to the config file ?
It's a legacy system that used BDE.
I know BDE is no longer recommended or supported but we just need to change
the 2 entries, eg SharedMemLocation = 0x5BDE.
Ed
On 16.11.2012 03:58, Edwin Grimshaw wrote:
> Is there a way to programmatically change a BDE System value (SharedMemSize
> and SharedMemLocation) ?
yes: from http://dn.codegear.com/pl/article/23231
function SetBDEConfigValue(const ConfigurationPath, ValueName, NewValue:
string): boolean;
// source from CodeGear: http://dn.codegear.com/pl/article/23231
// ConfigurationPath: '\DRIVERS\PARADOX\INIT' or '\SYSTEM\INIT'
// ValueName: 'NET DIR' or 'LOCAL SHARE'
// NewValue: 'J:\MyDir' or 'TRUE'
var
hCur : hDBICur;
Config : CFGDesc;
ContinueIt: boolean;
begin
Result := False;
if DbiInit(nil) = DBIERR_NONE then begin
hCur := nil;
if DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPersistent,
PChar(ConfigurationPath), hCur) = DBIERR_NONE then begin
if DbiSetToBegin(hCur) = DBIERR_NONE then begin
ContinueIt := true;
while ContinueIt do begin
if(DbiGetNextRecord(hCur, dbiWRITELOCK, @Config, nil) <>
DBIERR_NONE) then
ContinueIt := false
else if StrIComp(Config.szNodeName, PChar(ValueName)) = 0
then begin
StrCopy(Config.szValue, PChar(NewValue));
Result := DbiModifyRecord(hCur, @Config, true) = DBIERR_NONE;
ContinueIt := false
end;
end;
end;
end;
DbiExit();
end;
end;
Mel
"Goran Ekstrom" wrote in message
news:524405@forums.embarcadero.com...
> snip
>
>> Result := DbiModifyRecord(hCur, @Config, true) = DBIERR_NONE;
>
> This line seems to be needed after DbiModifyRecord:
>
> DbiCloseCursor(hCur)
>
> No modifications to IDAPI.CFG is made without it, at least not for me, and
> all of it must be run with Admin priv. on UAC OS:es.
>
> Regards
> Goran
Only if:
(1) You have not set the BDE to use its cfg file (ie WIN 3.1 compatibility)
and
(2) the CFG file resides under the Program Files folder.
Change both of these and you do not require Admin Level.
Leslie.
if this is an issue at only one site, I'd save the trouble and just make the
changes in BDE Administrator. I strongly recommend going into
objects/options in the administrator and checking the win 3.1 box. you can
also make this change in the registry if that is easier. the accepted
values for the key are WINNT and WIN31. case seems to matter. I include
this change in my BDE installation routine which is a wrapper around the
Borland file. this change moves the values from the registry to the cfg
file which keeps windows from blocking you. also, give "everyone" full
control of the cfg file. again I do this in my install.
--
Frank M. Cook
www.funeralhomesoftware.info
"Edwin Grimshaw" wrote in message
news:522053@forums.embarcadero.com...
> Is there a way to programmatically change a BDE System value
> (SharedMemSize
> and SharedMemLocation) ?
>
> The Delphi Help mentions Session.SaveConfigFile if I add or delete an
> alias
> but nothing about individual system values.
>
> The BDE help (BDE32.hlp) also has no mention.
>
> I'm assuming there is a data structure somewhere which I can alter and
> save
> to the config file ?
>
> It's a legacy system that used BDE.
> I know BDE is no longer recommended or supported but we just need to
> change
> the 2 entries, eg SharedMemLocation = 0x5BDE.
>
> Ed
snip
> Result := DbiModifyRecord(hCur, @Config, true) = DBIERR_NONE;
This line seems to be needed after DbiModifyRecord:
DbiCloseCursor(hCur)
No modifications to IDAPI.CFG is made without it, at least not for me, and
all of it must be run with Admin priv. on UAC OS:es.
Regards
Goran
> Only if:
snip
OK, should have mentioned that my experiences are with a fully "default" and otherwise untouched BDE installation on a UAC OS.
Regards
Goran