Jump to content
  • Advertisement
Sign in to follow this  
Frank Force

Best way to load a webpage from C++

This topic is 3478 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a windows screensaver in a multi-threaded environment. Trying to load a webpage when someone clicks on a button. Was using the code... ShellExecute(NULL, L"open", L"http://www.frankforce.com", NULL, NULL, SW_SHOWNORMAL); Worked ok except there was a bug. I use zonealarm so when the firewall popped up about this program trying to access the internet I decided to try blocking it's access. This caused the thread to never exit and the program to stay running in background even though you could still set the settings and click the ok button. Eventually multiple copies would be running in background until manually shut down. Checked in debugger and saw that the ShellExecute function never exits in this case. Read up on stuff. Now using new improved call to open webpage. SHELLEXECUTEINFOW shellInfo; ZeroMemory (&shellInfo, sizeof (SHELLEXECUTEINFO)); shellInfo.cbSize = sizeof(shellInfo); shellInfo.fMask = SEE_MASK_ASYNCOK; shellInfo.lpVerb = L"open"; shellInfo.lpFile = L"http://www.frankforce.com"; shellInfo.nShow = SW_SHOWNORMAL; ShellExecuteEx(&shellInfo); The key difference is the SEE_MASK_ASYNCOK which kicks control right back after the call. Seems to work well now. But I noticed a glitch maybe a security hole in zone alarm. If i disallow my program's access and then just rapidly click on the button that tries to load the webpage eventually it will load the webpage even though zonalarm should prevent it. What's going on here? - Frank Force

Share this post


Link to post
Share on other sites
Advertisement
Here's my guess (take with some salt):

ZoneAlarm works on a per-process basis. Any process that tries to create a connection is checked to see if it is allowed. However, what you are doing is creating a new process, this time for the web browser (or whatever your default URL handler is). So ZoneAlarm sees two processes: yours, which is not actually connecting to the Internet, and the browser, which is connecting. Unless the browser is blocked by ZoneAlarm, it should work just fine.

Share this post


Link to post
Share on other sites
Was using Firefox as default browser. Just tested with Chrome. With chrome I don't get any firewall popup with my code. I think is is Firefox that has a feature of kicking it over to zonealarm if another process tries to open a webpage. So basically I think it's just Firefox that is being glitchy.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!