Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

INI Help and Install module

gennygabsgennygabs Posts: 12Member
Hi,

so far, i've found a way to read INI file using this code below;

Public Sub ReadIniFile()
Dim inifile
Dim strReadLine
Dim intReadLine As Integer
'
intReadLine = 0
'---Set connection to open the cartridge.ini file
Set inifile = Filesys.OpenTextFile(App.Path & "CCsetup.ini", ForReading)
'--------------

Do While inifile.AtEndOfStream <> True 'argument when pointer reaches the eof
strReadLine = inifile.ReadLine 'Reads the .ini file line by line
intReadLine = intReadLine + 1 'count the current line
'Reads the line and opens the picture
If intReadLine = 3 Then
strWalls = Trim$(Mid(strReadLine, 16))
ElseIf intReadLine = 7 Then
' if pointer is in line 6, extracts the dbase path
strCCDbase = Trim$(Mid(strReadLine, 14))
ElseIf intReadLine = 8 Then
' if pointer is in line 6, extracts the dbase path
strRemisDbase = Trim$(Mid(strReadLine, 17))
ElseIf intReadLine = 9 Then
' if pointer is in line 6, extracts the dbase path
strFelisDbase = Trim$(Mid(strReadLine, 17))
End If
Loop 'next line

MDIForm1.Picture = LoadPicture(strWalls)
Set DelLogFile = Filesys.OpenTextFile(App.Path & "CClog.log", ForAppending, True)
End Sub

Basically it scans the ini file and runs the the path in strCCDbase,strRemisDbase, and strFelisDbase. Now that i got the part of the problem figured out, the only thing i need is where i could edit the path in the str variables i've mentioned using the same idea.

And i only planning on creating an installation-like program in which it copies your files from a source to a given destination path. Want i want to happen is that the program will copy a set of files to a given path by the user. I would the INI file in this case. How do make one without going for the package and deployment wizard/


Thanks


Comments

  • BarkeeperBarkeeper Posts: 335Member
    Errr..... did you never heard of API, especially about ReadPrivateProfileString and WritePrivatProfileString?

    : Hi,
    :
    : so far, i've found a way to read INI file using this code below;
    :
    : Public Sub ReadIniFile()
    : Dim inifile
    : Dim strReadLine
    : Dim intReadLine As Integer
    : '
    : intReadLine = 0
    : '---Set connection to open the cartridge.ini file
    : Set inifile = Filesys.OpenTextFile(App.Path & "CCsetup.ini", ForReading)
    : '--------------
    :
    : Do While inifile.AtEndOfStream <> True 'argument when pointer reaches the eof
    : strReadLine = inifile.ReadLine 'Reads the .ini file line by line
    : intReadLine = intReadLine + 1 'count the current line
    : 'Reads the line and opens the picture
    : If intReadLine = 3 Then
    : strWalls = Trim$(Mid(strReadLine, 16))
    : ElseIf intReadLine = 7 Then
    : ' if pointer is in line 6, extracts the dbase path
    : strCCDbase = Trim$(Mid(strReadLine, 14))
    : ElseIf intReadLine = 8 Then
    : ' if pointer is in line 6, extracts the dbase path
    : strRemisDbase = Trim$(Mid(strReadLine, 17))
    : ElseIf intReadLine = 9 Then
    : ' if pointer is in line 6, extracts the dbase path
    : strFelisDbase = Trim$(Mid(strReadLine, 17))
    : End If
    : Loop 'next line
    :
    : MDIForm1.Picture = LoadPicture(strWalls)
    : Set DelLogFile = Filesys.OpenTextFile(App.Path & "CClog.log", ForAppending, True)
    : End Sub
    :
    : Basically it scans the ini file and runs the the path in strCCDbase,strRemisDbase, and strFelisDbase. Now that i got the part of the problem figured out, the only thing i need is where i could edit the path in the str variables i've mentioned using the same idea.
    :
    : And i only planning on creating an installation-like program in which it copies your files from a source to a given destination path. Want i want to happen is that the program will copy a set of files to a given path by the user. I would the INI file in this case. How do make one without going for the package and deployment wizard/
    :
    :
    : Thanks
    :
    :
    :

    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • gennygabsgennygabs Posts: 12Member
    Well i do, i'm just wondering if there a way to edit Ini using the same idea with the code that i displayed..

    : Errr..... did you never heard of API, especially about ReadPrivateProfileString and WritePrivatProfileString?
    :
    : : Hi,
    : :
    : : so far, i've found a way to read INI file using this code below;
    : :
    : : Public Sub ReadIniFile()
    : : Dim inifile
    : : Dim strReadLine
    : : Dim intReadLine As Integer
    : : '
    : : intReadLine = 0
    : : '---Set connection to open the cartridge.ini file
    : : Set inifile = Filesys.OpenTextFile(App.Path & "CCsetup.ini", ForReading)
    : : '--------------
    : :
    : : Do While inifile.AtEndOfStream <> True 'argument when pointer reaches the eof
    : : strReadLine = inifile.ReadLine 'Reads the .ini file line by line
    : : intReadLine = intReadLine + 1 'count the current line
    : : 'Reads the line and opens the picture
    : : If intReadLine = 3 Then
    : : strWalls = Trim$(Mid(strReadLine, 16))
    : : ElseIf intReadLine = 7 Then
    : : ' if pointer is in line 6, extracts the dbase path
    : : strCCDbase = Trim$(Mid(strReadLine, 14))
    : : ElseIf intReadLine = 8 Then
    : : ' if pointer is in line 6, extracts the dbase path
    : : strRemisDbase = Trim$(Mid(strReadLine, 17))
    : : ElseIf intReadLine = 9 Then
    : : ' if pointer is in line 6, extracts the dbase path
    : : strFelisDbase = Trim$(Mid(strReadLine, 17))
    : : End If
    : : Loop 'next line
    : :
    : : MDIForm1.Picture = LoadPicture(strWalls)
    : : Set DelLogFile = Filesys.OpenTextFile(App.Path & "CClog.log", ForAppending, True)
    : : End Sub
    : :
    : : Basically it scans the ini file and runs the the path in strCCDbase,strRemisDbase, and strFelisDbase. Now that i got the part of the problem figured out, the only thing i need is where i could edit the path in the str variables i've mentioned using the same idea.
    : :
    : : And i only planning on creating an installation-like program in which it copies your files from a source to a given destination path. Want i want to happen is that the program will copy a set of files to a given path by the user. I would the INI file in this case. How do make one without going for the package and deployment wizard/
    : :
    : :
    : : Thanks
    : :
    : :
    : :
    :
    : ------------------------------------------
    : Only stupidity of mankind and the universe
    : are infinite, but i'm not sure concerning
    : the universe. A. Einstein
    :
    :

  • BarkeeperBarkeeper Posts: 335Member
    : Well i do, i'm just wondering if there a way to edit Ini using the same idea with the code that i displayed..
    :
    : : Errr..... did you never heard of API, especially about ReadPrivateProfileString and WritePrivatProfileString?
    : :

    Just check out the MSDN for both above mentioned API's. That should do the trick you want
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

Sign In or Register to comment.