Sub saveFileLoc()
  
    Dim x%
    Dim fName As String
    Dim sf(6) As String
    Dim i As Integer
    On Error Resume Next
    
    For i = 0 To 4
       sf(i) = Text1(i).Text
    Next i
    
    fName = App.Path & "\CTP.ini"
    
    
    x% = OSWritePrivateProfileString("OPTFILE", "PORO", sf(0), fName)
   
End Sub
Sub getSettingInfo()    Dim x%, i
    Dim fName As String, WStmp As String, Onechar As String * 1
    Dim NoStr As String * 1
    Dim myWS As String
    
    On Error Resume Next
    
    myWS = Space$(1024)
    
    fName = App.Path & "\CTP.ini"
    '------------------------------------------------------------------------------
    x% = OSGetPrivateProfileString("OPTFILE", "PORO", "", myWS, Len(myWS), fName)
    If x% > 0 Then
       Text1(0).Text = myWS
    End If
   
End Sub
pop为动态数组

解决方案 »

  1.   

    This cross-platform example reads the myapp.ini file and displays on the form the status of your auto save options.
    Before you run this example, you must add the IniFiles unit to the uses clause ofinclude IniFiles.hpp in your unit.procedure TForm1.FormActivate(Sender: TObject);var
      MyIniFile: TIniFile;
    begin
      MyIniFile := TIniFile.Create('myapp.ini');
      with MyIniFile do
      begin
        if ReadBool('AutoLoad', 'FormProperties', False) = True then
        begin
          Visible := ReadBool('FormOptions', 'Visible', True);
          Color := TColor(ReadInteger('FormOptions', 'Color', clNormalBackground));
          Caption := ReadString('FormOptions', 'Caption', 'Main');
      end;
      MyIniFile.Free;end;
      

  2.   

    我看不懂啊!!我刚刚查了api函数
    在delphi中我也可以直接调用那个函数但参数不一样啊
    我需要
    x:= WritePrivateProfileString('OPTLIMIT', 'PORO', d_gPORO_Limit, fName);
    把string  转换为pansichar怎样转换啊!!!!
    我用这个可以吧