CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2001
    Posts
    2

    Help with two things....

    I have a very small program that opens up internet explorer (here it is):

    Private Sub Form_Load()
    Page$ = "d:\myfile.html"
    ShellX = Shell("explorer.exe " + Page$)
    End Sub

    There are two things I would like to do with thism but I have no clue how to do it.

    1) I am using Form_OnLoad which automatically launches IE once the program is activated. The problem, however, is the form actually pops up too. I would like the program to just run and have IE start but do not have the form from my program to show up.

    2) This program will be located on a CD Rom and I want it to open a .html file that will be on this CD Rom. The problem, however, is that I cannot hard code the pathway for the CD rom because the CD Rom will be different from machine to machine.

    How can I set Page$ = "d:\myfile.html" so that it will open myfile no matter what drive it is on?

    Can someone please help? I have no clue how to do either of these.

    Thanks,
    Master Incubus



  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Help with two things....


    '1). A simple END statement after your Shell 'command will terminate your program like so
    '
    private Sub Form_Load()
    Page$ = "d:\myfile.html"
    ShellX = Shell("explorer.exe " + Page$)
    END ' Terminate this program
    End Sub

    '2). IF you use the App.Path statement then 'whatever location your App is running is used.
    'If your program is running on "F:\" using
    App.Path will like so
    '
    Page$ = App.Path & "MyFile.htm"
    '
    will produce results that look like
    '
    Page$ = "F:\MyFile.htm"
    '
    If your program is running from a directory other than the root directory,
    then App.Path will show something like this. if your app is running on "D:\MyPath" then
    App.Path would show "D:\MyPath".
    IN this case you would need to add the backslash to your Page$ assignement like this
    '
    Page$ = App.Path & "\MyFile.htm"
    '
    this will produce somwthing like this
    '
    Page$ = "D:\MyPath\MyFile.htm"




    John G

  3. #3
    Join Date
    Apr 2001
    Location
    CA
    Posts
    153

    Re: Help with two things....

    don't put your code on a form if you don't want a the form to show.

    i would:

    create a standard module with a sub main()
    put your code in main
    remove the form from the project
    set main as the startup object (project properties, general tab)

    also, if you put myfile.html in the same folder as myapp.exe you don't have to specify a path just do Page$="myfile.html"





    thanx/good luck,
    adam
    thanx/good luck

  4. #4
    Join Date
    Aug 2001
    Posts
    2

    Re: Help with two things....

    Hi guys,

    Thanks for the help, I will give your suggestions a try and let you know how it goes.

    Thanks again,
    MI


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