CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Location
    Minneapolis
    Posts
    98

    [VB] ShellExecute to open many windows

    I am trying to open 2 to 3 web browsers with a call to shellexecute() but shellexecutes uses the same window all of the time.. example I ask shellexecute to load www.yahoo.com and www.google.com.. they both go up in the same window and I have to hit the back button to see the first site... I want it to open up in 2 different windows..

    code::


    Dim ii As Integer
    For ii = 0 To urllist.length - 1
    rc = ShellExecute(App.hInstance, "open", _
    urllist.Item(ii).Text, vbNullString, "C:\", _
    SW_SHOWNORMAL)
    Next ii

    urllist.Item(0).Text = www.yahoo.com
    urllist.Item(1).Text = www.google.com

    I want these to come up in 2 seperate windows..

    thanks in advanced

  2. #2
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    263
    if you want them to open in seperate windows , dont use shellexecute , use Shell . eg:
    Code:
    Private Sub Command1_Click()
            Dim strUrls() As String
            Dim x As Integer
    
            strUrls = Split("http://google.com,http://yahoo.com", ",")
    
            For x = LBound(strUrls) To UBound(strUrls)
                Shell("explorer.exe " & strUrls(x), vbNormalFocus)
            Next
    
        End Sub
    string Signature = Censored;

  3. #3
    Join Date
    May 2002
    Location
    Minneapolis
    Posts
    98

    small addition to sysop code

    Shell("explorer.exe " & Chr$(34) _
    & urllist.Item(ii).Text & Chr$(34), vbNormalFocus)

    this works better cause it contains all of the data.
    otherwise you may have some trouble with SOME urls

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