?
Solved

ShellExecute()  How do I change it to open a new window everytime?

Posted on 2007-03-30
6
Medium Priority
?
658 Views
Last Modified: 2010-08-05
Expert Gurus
How do I change it to open a new window everytime?
 Please let me know.
 
Many Thanks

Ted


        Private Declare Function ShellExecute Lib _
                      "shell32.dll" Alias "ShellExecuteA" _
                      (ByVal hwnd As Long, _
                       ByVal lpOperation As String, _
                       ByVal lpFile As String, _
                       ByVal lpParameters As String, _
                       ByVal lpDirectory As String, _
                       ByVal nShowCmd As Long) As Long
                       
        Private Const SW_SHOW = 1

        Public Sub Navigate(ByVal NavTo As String)
          Dim hBrowse As Long
          hBrowse = ShellExecute(0&, "open", NavTo, "", "", SW_SHOW)
        End Sub
0
Comment
Question by:tcalbaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18826346
Well that depends...

What is in "NavTo"?
0
 
LVL 1

Author Comment

by:tcalbaz
ID: 18826443
Nav_to is the URL.

Ted
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 18826835
One way...

Click on Project --> References and check the "Microsoft Internet Controls" entry.

    Public Sub Navigate(ByVal NavTo As String)
        Dim ie As New InternetExplorer
        ie.Visible = True
        ie.Navigate NavTo
    End Sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 18828041
That does means hardcoding IE as webbrowser.

When you say new window, is it opening in a new tab sometimes ?  IE7 / FireFox2 ?
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 1000 total points
ID: 18828056
see "How ShellExecute Determines Whether to Start a New Instance" in http://support.microsoft.com/kb/224816

example from MS is slightly different in that they dont use null for some reason.
   Dim r As Long
   r = ShellExecute(0, "open", "http://www.microsoft.com", 0, 0, 1)
0
 
LVL 1

Author Comment

by:tcalbaz
ID: 18828830
IdleMind
Thanks for the solution.

robberbaron
Very insightful and useful article.

I have split the points
Thank you

Ted
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question