X++:
// I use Firefox ;-)
handle = WinAPI::regOpenKey(#HKEY_CURRENT_USER, 'SOFTWARE\\Classes\\HTTP\\shell\\open\\command', #KEY_READ);
if (! handle)
handle = WinAPI::regOpenKey(#HKEY_CLASSES_ROOT, 'HTTP\\shell\\open\\command', #KEY_READ);
if (handle)
{
regValue = WinAPI::regGetValue(handle, '');
if (regValue && typeOf(conpeek(regValue, 1)) == Types::String)
browserPath = conpeek(regValue, 1); // like "C:\Programme\Internet Explorer\IEXPLORE.EXE" -nohome
// or C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "%1" -requestPending
// cut off the optional command-line parameters
quoteOpenPos = strfind(browserPath, '\"', 1, strlen(browserPath));
quoteClosPos = strfind(browserPath, '\"', quoteOpenPos+1, strlen(browserPath));
if (quoteOpenPos == 1 && quoteClosPos)
{
browserPath = substr(browserPath, quoteOpenPos, quoteClosPos-quoteOpenPos+1);
}
else
{
browserPath = strrem(browserPath, '\"');
// from the beginning till the first space before a parameter
do
{
spacePos = strfind(browserPath, ' ', spacePos+1, strlen(browserPath));
}
while(spacePos && strfind(browserPath, '\\.', spacePos+1, strlen(browserPath)));
if (spacePos)
browserPath = substr(browserPath, 1, spacePos-1);
}
}
if (! browserPath)
browserPath = #IEXPLORE_PATH;
WinAPI::shellExecute(browserPath, url);
}