Results 1 to 4 of 4

Thread: Startup attributes

  1. #1

    Thread Starter
    Lively Member UTGrim's Avatar
    Join Date
    Jan 2005

    Startup attributes

    Hey guys,

    I'm making a little tool/app that's supposed to perform different actions depending on an attribute passed to it when it's run. It's hard for me to describe it, but I know there is a function of some sort (I've used it before) that retrieves the attributes.

    For example, by running this on a batch file,

    start c:\myProg.exe myTextFile.txt

    With myProg being the app I'm writing and myTextFile being a text file it's supposed to open. This function would retrieve "myTextFile.txt"

    Does anyone know its name?



  2. #2
    Join Date
    Dec 2004

    Re: Startup attributes

    the command variable contains the command line arguments passed
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed

  3. #3
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006

    Re: Startup attributes

    If you mean file parameters, you can use Command$ to retrieve them.

    Private Sub Form_Load()
     ' i.e. Change my program to blue background on start.
     ' MyProgram.exe blue
       Select Case Command$    
        Case "blue"
            Me.BackColor = vbBlue
        Case "red"
            Me.BackColor = vbRed
        End Select
    End Sub
    To test you parameter(s) in the IDE go to Project Poperties, select the Make Tab, enter the text in the Command Line Properties box. Clear that text box before you compile.

  4. #4
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007

    Re: Startup attributes

    Are you referring to file attributes ? If yes then:
    Function GetAtts(filename as string) as String
    Dim result as String
    Dim att as Long
    att = GetAttr(filename)
    If att And vbDirectory then result = result & " Directory"
    If att And vbReadOnly then result = result & " ReadOnly"
    If att And vbHidden then result = result & " Hidden"
    If att And vbSystem then result = result & " System"
    If att And vbArchive then result = result & " Archive"
    GetAtts = Mid$(result, 2)
    End Function
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

Posting Permissions

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


Click Here to Expand Forum to Full Width