Mega Search
23.2 Million


Sign Up

Make a donation  
Programmatically changing System Values  
News Group: embarcadero.public.bde.general

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

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 15-Nov-2012, at 6:58 PM EST
From: Edwin Grimshaw
 
Re: Programmatically changing System Values  
News Group: embarcadero.public.bde.general
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

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 16-Nov-2012, at 2:19 AM EST
From: M. E.L.
 
Re: Programmatically changing System Values  
News Group: embarcadero.public.bde.general
"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.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 23-Nov-2012, at 5:08 PM EST
From: Leslie Milburn
 
Re: Programmatically changing System Values  
News Group: embarcadero.public.bde.general
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

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 26-Nov-2012, at 9:46 AM EST
From: Frank M. Cook
 
Re: Programmatically changing System Values  
News Group: embarcadero.public.bde.general
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

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 22-Nov-2012, at 3:14 PM EST
From: Goran Ekstrom
 
Re: Programmatically changing System Values  
News Group: embarcadero.public.bde.general
> 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

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 24-Nov-2012, at 11:57 AM EST
From: Goran Ekstrom