How to use WebControl to view local .html page?

Just starting out? Need help? Post your questions and find answers here.
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

How to use WebControl to view local .html page?

Post by LJ »

Hi everyone. New message forum is great.

I am wondering is it possible to use the webcontrol to view a .html page stored in a directory?

The problem I'm having is that I want to view a .html web page that is stored in the local directory. I don't want to hard code the entire path name in the WebGadget line because if someone installs the program in a different directory, or different drive letter, it will not work. Is there a way to have the WebGadget display a .html page in the current directory? (The same directory that the .pb compiled file is in?)
:?:
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: How to use WebControl to view local .html page?

Post by PB »

> Is there a way to have the WebGadget display a .html page in the
> current directory?

Just make the URL the name of the local file. (Incorrect example snipped)
Last edited by PB on Sat May 10, 2003 7:04 am, edited 2 times in total.
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Post by LJ »

The example you gave doesn't work... it says
Action cancelled... page not found
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> The example you gave doesn't work...

You're right -- I forgot that you must use the full path. :(

Here's an updated example that gets the path of your running app before
calling the local file... :)

Code: Select all

If OpenWindow(0,200,200,450,200,#PB_Window_SystemMenu,"Test")
  CreateGadgetList(WindowID())
  appdir$=Space(255) : GetCurrentDirectory_(255,@appdir$) : If Right(appdir$,1)<>"\" : appdir$+"\" : EndIf
  url$=appdir$+"LocalFile.htm"
  WebGadget(0,5,5,440,190,url$)
  Repeat
    ev=WaitWindowEvent()
  Until ev=#PB_EventCloseWindow
EndIf
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Post by LJ »

You da bomb PB! That worked! If you have a chance to be the teacher and explain why it worked it would be very much appreciated oh wise guru. Thanks again! :P
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> If you have a chance to be the teacher and explain why it worked it
> would be very much appreciated

To be honest, I don't know why you need the full path -- I think it's just a
web browsing thing, just like you need a full URL when pasting into a web
browser to surf the net.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

PB wrote: To be honest, I don't know why you need the full path -- I think it's just a
web browsing thing, just like you need a full URL when pasting into a web
browser to surf the net.
I think that its because webbrowser its not like other gadgets, in fact 'maybe' the webbrowser working path is not the PB path but the IExplorer path.
ARGENTINA WORLD CHAMPION
Post Reply