在COM+中是不是不能进行磁盘文件读写操作,例如读写INI文件或读写TXT文件。

解决方案 »

  1.   

    怎么操作,我的程序中读取INI文件中的string总是反回空值,同样的代码在普通程序中运行就没有问题。能详细说说吗?
      

  2.   

    你贴出代码看看。
    可能跟你的Ini文件路径有关系吧,你先使用绝对路径试试。
      

  3.   

    绝对路径也试过了。读INI String代码如下:
    function ReadFromIniFile(const Section, Key: string): string;
    var
      iniFile: TIniFile;
      FileName: string;
      tempValue: string;
    begin
    //  FileName := GetFilePath + cConfigFileName;
      FileName := cConfigFileName;
      iniFile := TIniFile.Create(FileName);
      try
        with iniFile do begin
          tempValue := ReadString(Section, Key, '');
          Result := tempValue;
        end;
      finally
        iniFile.Free;
      end;
    end;