Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB6 - Open web ling with Firefox

Posted on 2014-07-23
5
Medium Priority
?
249 Views
Last Modified: 2014-07-25
Hi.

I would like to know how i can force the web link to open with Firefox and still leave IE as the default browser.

Is that possible?

Thanks for your help

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

    ShellExecute Me.hwnd, vbNullString, _
                 "www.google.ca", _
                 vbNullString, App.Path, SW_SHOWNORMAL

Open in new window

0
Comment
Question by:Wilder1626
5 Comments
 
LVL 5

Expert Comment

by:Chris Watson
ID: 40214530
Shell "C:\Program Files (x86)\Mozilla Firefox\Firefox.exe ""http://www.google.ca""", vbNormalFocus 

Open in new window


Provided that Firefox is installed in the standard location on a 64-bit PC this will open http://www.google.ca in Firefox without requiring changing the default browser. If Firefox is installed in a different location, update the path accordingly.
0
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40214536
What Chris said is correct to a point, you would need to query the registry first to see where firefox is installed.
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40214562
it seems he want to get the handler of hwnd from firefox application as we did it for IE

Author, please  write more about this if it is

Duncan
0
 
LVL 5

Accepted Solution

by:
Chris Watson earned 2000 total points
ID: 40214792
I like Randy's suggestion for improving the robustness of the strategy.

It seems that the location of the Firefox executable is stored in the registry. The correct key is dependant upon a few things, including the version number of Firefox installed and the version of Windows in use.

For example, for Firefox 30 on Windows 7 (64-bit) the registry path is:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\30.0 (en-GB)\Main\PathToExe

Open in new window

0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 40219266
Thanks a lot for the help. This is working great.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

783 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