Board index » delphi » Setting MAXFILEHANDLES at runtime

Setting MAXFILEHANDLES at runtime

Does anyone know how to set MAXFILEHANDLES at runtime?
Thanks
Lauretta
 

Re:Setting MAXFILEHANDLES at runtime


See the examples for DbiOpenCfgInfoList at
www.borland.com/devsupport/bde/bdeapiex .

--
Bill Todd (TeamB)
(Questions received via email cannot be answered.)

Re:Setting MAXFILEHANDLES at runtime


On Sat, 19 Aug 2000 14:58:16 -0700, "Lauretta Carroll"

Quote
<carr...@legacypress.com> wrote:
>Does anyone know how to set MAXFILEHANDLES at runtime?

Try this:

  procedure SetupBDEFileHandles;
  const
     InitPath = '\System\Init';
     MaxHandlesDesc = 'MaxFileHandles';
     MaxHandlesValue = 96;
  var
     Cursor: HDbiCur;
     ConfigDesc: CfgDesc;
     MaxHandles: Integer;
  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, MaxHandlesDesc) = 0 then
           begin
              MaxHandles := StrToInt0(ConfigDesc.szValue);
              if MaxHandles < MaxHandlesValue then
              begin
                 Check(DbiGetRecord(Cursor, dbiWriteLock, @ConfigDesc,
                   nil));
                 StrPCopy(ConfigDesc.szValue,
                   IntToStr(MaxHandlesValue));
                 Check(DbiModifyRecord(Cursor, @ConfigDesc, True));
              end;
           end;
        end;
     finally
        DbiCloseCursor(Cursor);
        Check(DbiExit);
     end;
  end;

Call this procedure before the BDE is initialized.  Otherwise, you
have to remove the call to DbiInit/Exit and the changes won't take
effect until the application is restarted.

Jan

Other Threads