Results 1 to 10 of 10

Thread: Need little help with vb6

  1. #1
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867

    Need little help with vb6

    In a settings.ini file i have a line with two commands (bike and fly)
    Code:
    [SETTINGS]
    cmd=bike fly
    I try to test if one of these two commands is used .
    So i have tried these lines without success.

    Can you help me please ?

    Thanks

    Code:
    Public Function ProcessCommand(CMD As String, frm As Object) As Integer
    Dim iniFile As New ClsIniFile
    Dim CommandName
    Dim DisableScreenName As String
    Dim i As Long
    iniFile.FileName = App.Path & "/settings.ini"
    iniFile.ApplicationKey = "SETTINGS"
    CommandName = Split(iniFile.GetValue("cmd", ""), " ")
    
        Select Case LCase(CMD)       
            Case "testds"
                MsgBox "This is a test", vbOKOnly, "by pierrotm777"
                ProcessCommand = 2
        End Select
        
        For i = 0 To UBound(CommandName(i)) - 1
            If CMD = CommandName(i) Then
                CMD = "load;myskin.skin"
                ProcessCommand = 3
            End If
        Next i
    End Function

  2. #2
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,630
    cmd=bike fly


    will have entries in

    CommandName(0) - bike
    CommandName(1) - Fly


    ubound(commandname)=1

    you are subtracting 1 so it will only look at bike, not at fly


    Also I think you need to declare CommandName with brackets to make it an array and preferably as a type

    Dim CommandName() as string

  3. #3
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867
    Ok ,
    So, i write that:
    Code:
    Public Function ProcessCommand(CMD As String, frm As Object) As Integer
    Dim iniFile As New ClsIniFile
    Dim CommandName ()
    Dim DisableScreenName As String
    Dim i As Long
    iniFile.FileName = App.Path & "/settings.ini"
    iniFile.ApplicationKey = "SETTINGS"
    CommandName () = Split(iniFile.GetValue("cmd", ""), " ")
    
        Select Case LCase(CMD)       
            Case "testds"
                MsgBox "This is a test", vbOKOnly, "by pierrotm777"
                ProcessCommand = 2
        End Select
        
        For i = 0 To UBound(CommandName(i))
            If CMD = CommandName(i) Then
                CMD = "load;myskin.skin"
                ProcessCommand = 3
            End If
        Next i
    End Function

  4. #4
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867
    But i have an error on the Ubound

  5. #5
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,630
    Try


    Code:
    Public Function ProcessCommand(CMD As String, frm As Object) As Integer
    Dim iniFile As New ClsIniFile
    Dim CommandName () as String
    Dim DisableScreenName As String
    Dim i As Long
    iniFile.FileName = App.Path & "/settings.ini"
    iniFile.ApplicationKey = "SETTINGS"
    CommandName  = Split(iniFile.GetValue("cmd", ""), " ")
    
    Select Case LCase(CMD) 
    Case "testds"
    MsgBox "This is a test", vbOKOnly, "by pierrotm777"
    ProcessCommand = 2
    End Select
    
    For i = 0 To UBound(CommandName)
    If CMD = CommandName(i) Then
    CMD = "load;myskin.skin"
    ProcessCommand = 3
    End If
    Next i
    End Function

  6. #6
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867
    Enforcer,
    You are the best !

    Big thanks

  7. #7
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,630
    Quote Originally Posted by pierrotm777 View Post
    Enforcer,
    You are the best !

    Big thanks


    Now stop using app.path in the middle of the process command routine. Assign it to a variable at start up. Please!!!

    ---------- Post added at 09:56 AM ---------- Previous post was at 09:56 AM ----------

    Quote Originally Posted by pierrotm777 View Post
    Enforcer,
    You are the best !

    Big thanks


    Now stop using app.path in the middle of the process command routine. Assign it to a variable at start up. Please!!!

  8. #8
    THE EXPERIMENTER
    Auto Apps:loading...
    carputer1's Avatar
    Join Date
    Sep 2007
    Location
    UK,Surrey
    Posts
    1,979
    lol making sure the message gets trough lol....
    Riderunner / Genesis
    Plugin Breaker in test BassRR Plugin Player, Wifiman_NET
    New Home for Genesis & BassRR :adding to site ,, Hellfyre night
    Bassrr Beta Release :Version 1.3.7
    Movie_info Release :Version 3.1.0
    Wifiman_NET:Version 1.0.0

    Every Future, Needs A Beginning

  9. #9
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,630
    Quote Originally Posted by carputer1 View Post
    lol making sure the message gets trough lol....

    Actually, I only posted it once.


    Then I edited it, looks like a bug with the Combining of posts.

  10. #10
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867
    Where i must to do that and how ?
    Into the RRextension.cls, after that ?
    Option Explicit

    Dim RunOnce As Boolean ' set to prevent a double execution of code
    Dim RRSDK As RRSDK ' set type of var to the subclass

    ---------- Post added at 02:57 PM ---------- Previous post was at 02:55 PM ----------

    Ho, I think that i have found how to do.

    Public Sub Initialize(pluginDataPath As String)

    Dim t

    On Error Resume Next
    t = GetAttr(pluginDataPath) ' if error, then we dont have this directory existing
    If IsEmpty(t) = True Then CreateFolder pluginDataPath
    MainPath = pluginDataPath
    End Sub

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •