Jump to content

gotoWebPage broke?


Recommended Posts

This is the call


gotoWebPage("http://www.myweb.com/info.html");


this is the fail response in log


Platform::openWebBrowser - Failed to open the HKCR\http registry key!!!


The program is being run from downloads, just unzipped into a directory there.


Works on my machine but not others. They tried run as admin as well it fails

Link to post
Share on other sites

It's an issue with their OS rather than your app/Torque. Platform::openWebBrower() will fail on Windows machines if it can't find the registry key that points to the user's default web browser.


More info and some possible solutions:

https://social.msdn.microsoft.com/Forums/windows/en-US/aa3a1535-aa86-4afe-9fa2-c6345682efc9/registry-key-for-default-browser?forum=windowsgeneraldevelopmentissues

Link to post
Share on other sites

The code is correct Az (at least on Windows, poor Linux...) but if the registry key is missing for some reason it'll fail which sounds like what's happening in Hodo's case. There are some other registry keys we can check as well (the thread I linked lists those). Another potential alternative would be to call ShellExecute, something like:


 

 ShellExecute(NULL, "open", "website_URL_here", NULL, NULL, SW_SHOWNORMAL);
Link to post
Share on other sites

first draft, go ahead and throw this at it, see if that covers it...

bool Platform::openWebBrowser( const char* webAddress )
{
  //should handle unicode better here...
  int nRet = (int)ShellExecute(NULL, TEXT("open"), String(webAddress).utf16(), NULL, NULL, SW_SHOWNORMAL);
  if (nRet <= 32) {
    DWORD dw = GetLastError();
    wchar_t szMsg[250];
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dw, 0, szMsg, sizeof((const wchar_t*)szMsg), NULL);
    Con::errorf(ConsoleLogEntry::General, "Platform::openWebBrowser - Failed to open %s due to %s", webAddress, String(szMsg).c_str());
  }
  return( true );
}

 

seemed to this end. even popped my default browser, though given the flexibility of that... might (probably) need to cook up a more secure variation...

Link to post
Share on other sites
  • 11 months later...
  • 3 weeks later...

SDL will be adding SDL_OpenURL() in version 2.0.14. It's still pre-release, but it checks out on Win10 (opens url in default browser not IE). If it works on all supported platforms after the next SDL release, all of the platform specific openWebBrowser() calls can be eliminated and replaced with a single SDL call.

https://hg.libsdl.org/SDL/rev/d0348dab7c0f

See line 3.45.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...