What exactly about the codebank submission that you don't understand?
From a quick glance at the code, he is using a call to an API function, which works out the executable files associated with a particular file type, in this case an htm file. By doing this, he can work out the default browser. The executable file is then returned in the following code:
In the code that Kleinma posted, he is then simply passing this executable into a Process.Start which then fires up the default broswer, and he does this here:Code:'CALL THE API TO FIND THE EXE ASSOCIATED WITH HTM FILES RetVal = FindExecutable(FileName, vbNullString, BrowserExec) BrowserExec = BrowserExec.Trim
So rather than do the Process.Start line, you would inspect the BrowserExec variable. If this contains the string firefox, then you would do the firefox specific favourite saving, if the string contained iexplore, then you would do the internet explorer favourite saving. You could extend this to include any browsers that you wanted to support in your application.Code:'IF WE GET ONE, LAUNCH THE URL IN THE NEW INSTANCE OF THE BROWSER If RetVal <= 32 Or BrowserExec = String.Empty Then MessageBox.Show("Could not find a valid web browser") Else Process.Start(BrowserExec, strUrl) End If
Gary





Reply With Quote