Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Load a webpage externally
#1
Well first, it has been awhile since I last fiddled with BASIC, and I kept trying to hunt down the 'other' site that seems to have gone bye-bye. Oh well, I guess stuff happens.

Anyway, I am writing an app to help some folks in a group I support. Once of the things I'd kinda like the app to do is bring up a webpage based on a given URL is the user makes a certain selection in the program. I'm sure this has probably been ask before, but I've searched some, and finding nothing, probably due to not using the correct words to search on. Anyway, thanks for any help, Michelle
Reply
#2
(04-22-2022, 08:26 PM)Michelle Wrote: Well first, it has been awhile since I last fiddled with BASIC, and I kept trying to hunt down the 'other' site that seems to have gone bye-bye. Oh well, I guess stuff happens.

Anyway, I am writing an app to help some folks in a group I support. Once of the things I'd kinda like the app to do is bring up a webpage based on a given URL is the user makes a certain selection in the program. I'm sure this has probably been ask before, but I've searched some, and finding nothing, probably due to not using the correct words to search on. Anyway, thanks for any help, Michelle

Code: (Select All)
webpage$ = "https://qb64phoenix.com/forum/index.php"
SHELL _HIDE _DONTWAIT webpage$


Notes:

webpage$ is just a variable, call it anything you want, mywebpage$, url$, whatever.

_HIDE is used so the user doesn't see the command prompt of the SHELL open.

_DONTWAIT is used so the program continues to flow. Without it, the program will not advance until after the SHELL is closed.


I hope this is what you are looking for, and help get you started. Welcome to the forum. Glad you found your way here. The old site, QB64.rip is gone.

Pete
Reply
#3
Pete, thank you so much. It works wonderfully. I am pleased as punch..... Michelle
Reply
#4
okay.... how does that even work? I know it does because I used it earlier on two programs I'm working on that spit out htm files. But how does the shell know to open your default web browser? It works for local files with the .htm extension just fine and dandy but I must admit, I'm baffled as to why.
Reply
#5
(04-24-2022, 01:28 AM)James D Jarvis Wrote: okay.... how does that even work? I know it does because I used it earlier on two programs I'm working on that spit out htm files.  But how does the shell know to open your default web browser? It works for local files with the .htm extension just fine and dandy but I must admit, I'm baffled as to why.

In Windows Explorer, all programs open to whatever you set them to, or if you don't set them, a default program is often used, like NotePad, for text files. The SHELL call probably uses that info. So it automatically finds the path and browser exe. I haven't cared to spend the time to figure out if http, https, or .php, .html, etc. all or just some alert the system to open the browser.

Of course if you want a different browser, and you don't want to change your default browser in Explorer, you just add the name of the browser in the SHELL.


website$ = "https://qb64phoenix.com/forum/index.php"

SHELL _HIDE _DONTWAIT "Firefox.exe " + website$

Pete
Fake News + Phony Politicians = Real Problems

Reply
#6
Thank you. It somehow reminds me of batch files but i haven't touched those in 20 years.
Reply
#7
If you try and open a file with no association, Windows will pop up a message box, asking you to choose the right program to open and associate with it. Wink
Reply
#8
I use this same scenario to link to UPS and FedEx for tracking from within my application. The user right-clicks on the tracking number and it shells to the pre-formed string for the appropriate carrier's site and voila! You have instant tracking information available.

Another really nice use is to have Chrome open .PDF files from within your program. I do the same thing - right click and the .PDF opens within Chrome for the user.
Reply
#9
(04-26-2022, 01:57 AM)dano Wrote: I use this same scenario to link to UPS and FedEx for tracking from within my application.  The user right-clicks on the tracking number and it shells to the pre-formed string for the appropriate carrier's site and voila!  You have instant tracking information available.

Another really nice use is to have Chrome open .PDF files from within your program.  I do the same thing - right click and the .PDF opens within Chrome for the user.

I have a bunch of QB46 app associations like that, too. It's like having a mini-operating system, one that's actually useful! Can't do that with MicroSoft.

Pete

 - If a road runner can go straight through a solid rock wall that a coyote painted a tunnel on, does that mean the bird has a better understanding of quantum tunneling than Bill? My guess is yes!
Reply




Users browsing this thread: 2 Guest(s)