CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Location
    Ontario, Canada
    Posts
    2

    Set Shell Path at Runtim

    I have a VB6 application that is the startup.exe on a CD-Rom.
    Using the Shell command, this exe will launch one of two things on a
    command click - either another .exe to install a plug-in, or an HTML within
    the default browser.

    My code is as follows:

    Private Sub Command2_Click()
    Dim wd$
    Dim pa$
    Dim fe$

    wd = "D:\" ' set the working directory
    fe = "D:\default.htm" 'set the file to execute
    pa = "" ' Set the command line parameters

    ShellExecute hwnd, "open", fe, pa, wd, 1


    Question: Rather than manually defining the path, ie. "D:\", is there some
    way to determine where the user's CD-Rom is, and assign that to the path at
    runtime? Otherwise, the above code only works IF the user has d:\ as their
    CD-Rom!

    Thanks for any assistance!
    jamie



  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Set Shell Path at Runtim

    The path from which a program is run is held in:

    App.Path




    You could use this, as your exe is being run from the CD Rom.

    HTH,
    Duncan


    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  3. #3
    Join Date
    Mar 2001
    Location
    Ontario, Canada
    Posts
    2

    Re: Set Shell Path at Runtim

    Thank you! Worked like a charm! Such a simple solution, and yet it took me all morning to find it.

    jamie


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

Featured