Changed: Use NLMISC::openURL to open a page in browser
--HG-- branch : develop
This commit is contained in:
parent
85bb706900
commit
e0cb4bbe9e
1 changed files with 1 additions and 33 deletions
|
@ -920,39 +920,7 @@ LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)
|
||||||
|
|
||||||
void CGeorgesEditApp::gotoURL (LPCTSTR url)
|
void CGeorgesEditApp::gotoURL (LPCTSTR url)
|
||||||
{
|
{
|
||||||
char key[MAX_PATH + MAX_PATH];
|
NLMISC::openURL(tStrToUtf8(url));
|
||||||
|
|
||||||
// First try ShellExecute()
|
|
||||||
HINSTANCE result = ShellExecute(NULL, "open", url, NULL,NULL, SW_SHOW);
|
|
||||||
|
|
||||||
// If it failed, get the .htm regkey and lookup the program
|
|
||||||
if ((UINT)result <= HINSTANCE_ERROR) {
|
|
||||||
|
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT, ".htm", key) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
lstrcat(key, "\\shell\\open\\command");
|
|
||||||
|
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
char *pos;
|
|
||||||
pos = strstr(key, "\"%1\"");
|
|
||||||
if (pos == NULL)
|
|
||||||
{ // No quotes found
|
|
||||||
pos = strstr(key, "%1"); // Check for %1, without quotes
|
|
||||||
if (pos == NULL) // No parameter at all...
|
|
||||||
pos = key+lstrlen(key)-1;
|
|
||||||
else
|
|
||||||
*pos = '\0'; // Remove the parameter
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*pos = '\0'; // Remove the parameter
|
|
||||||
|
|
||||||
lstrcat(pos, " ");
|
|
||||||
lstrcat(pos, url);
|
|
||||||
result = (HINSTANCE) WinExec(key, SW_SHOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeorgesEditApp::WinHelp(DWORD dwData, UINT nCmd)
|
void CGeorgesEditApp::WinHelp(DWORD dwData, UINT nCmd)
|
||||||
|
|
Loading…
Reference in a new issue