gotoWebPage broke?

Scripting questions, discussions, etc
10 posts Page 1 of 1
Hodo33
Posts: 94
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Sat Nov 30, 2019 4:45 am
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
Happenstance
Posts: 93
Joined: Sat Apr 11, 2015 9:08 pm
by Happenstance » Sat Nov 30, 2019 6:01 pm
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/Forum ... mentissues
Bloodknight
Posts: 251
Joined: Tue Feb 03, 2015 8:58 pm
by Bloodknight » Sat Nov 30, 2019 11:00 pm
just to add to this, I'm sure it's not the default web browser, it's one of those commands that launch internet explorer, this happens quite a lot from a variety of applications, and many people uninstall it for whatever reason.
Azaezel
Posts: 473
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Sun Dec 01, 2019 10:29 am
Image quickietest this end looks like it's still functional... though I generally don't use IE, so odd that wouldn't pop the system-registered preferred browser.. got any additional info?
Bloodknight
Posts: 251
Joined: Tue Feb 03, 2015 8:58 pm
by Bloodknight » Sun Dec 01, 2019 11:24 am
I never use IE, but its still on my system because I don't clean out default installed junk, but still some places open IE vs default browser.

gotowebpage() launches IE on my system for... reasons
Azaezel
Posts: 473
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Sun Dec 01, 2019 11:52 am
https://github.com/GarageGames/Torque3D ... w.cpp#L528 will need to follow up on that..... looks correct, but...
also seems linux lacks it entirely: https://github.com/GarageGames/Torque3D ... orm.cpp#L3
Happenstance
Posts: 93
Joined: Sat Apr 11, 2015 9:08 pm
by Happenstance » Sun Dec 01, 2019 5:22 pm
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);
Azaezel
Posts: 473
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Sun Dec 01, 2019 9:15 pm
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...
Hodo33
Posts: 94
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Wed Dec 04, 2019 5:35 pm
Thanks for the info. User refuses to use IE and that is the issue. Thanks all for response.
Azaezel
Posts: 473
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Wed Dec 04, 2019 11:30 pm
well, like i said, this other popped chrome. so doable, just need to find time to root around and get the correct series of fallbacks for the keys to use so user preferred tries first..
10 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests