The way you're doing it is the way to open the default browser. The issue with that is it appears both IE and Firefox will always reopen the document instead of bringing the relevant tab to the front.
I thought you might be able to do browser-specific things with command-line switches. In that case, you should get the default browser from HKEY_CLASSES_ROOT\HTTP\shell\open\command.
Unfortunately, neither of the two major browsers have a switch to only open a URL that is not already opened. (IE switches here, Firefox switches here). Also, in the days of non-tabbed browsing I would have encouraged you to look at EnumWindows to find the relevant session, but that doesn't work anymore AFAIK.
My advice:
- Check default browser
- For IE, use Icebob's code. Also use this or your current ShellExecute code for browsers you don't explicitly support.
- For Firefox, check out developer.mozilla.org. There is bound to be some way.
- Ditto for webkit (Chrome, Safari) and Opera.
Or live with the duplicates. In that case, your ShellExecute code is perfect.
I would probably live with the duplicates.