View previous topic :: View next topic |
Author |
Message |
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Apr 13, 2004 9:21 am Post subject: Embedded HTML apps |
|
|
Here's a technique that people might be interested in. It requires VDS 5. I don't have a demo app so you'll have to work it out using code snippets.
Internet Explorer (and hence the BROWSER element) can load HTML pages, and stuff referenced within those pages, from resources compiled in the executable itself. VDS 5 can compile resources in the required format.
For example, your app could include the lines:
Code: | #resource add,23,styl.css,styl.css
#resource add,23,indx.htm,indx.htm
#resource add,23,res\spkr.gif,spkr.gif
#resource add,23,res\ear.gif,ear.gif |
Resource type 23 is the resource type needed for embedded HTML. Now you can see that they include an HTML page (indx.htm) a style sheet referenced in the HTML page, and two images.
You can load the HTML page by doing:
Code: | dialog set,Browser,res://myapp.exe/indx.htm |
Within the HTML you can access the resources using a URL like:
Code: | res://myapp.exe/ear.gif
res://myapp.exe/pg2.htm |
You can have hyperlinks to other embedded resource pages, so once you have loaded the first page, you can click and load other embedded HTML pages.
Note that you should set the current directory to the app's directory so this will work without specifying a full path.
Using the NONAVIGATE option of the BROWSER element, you can trap clicks on hyperlinks. You could have a link to:
Code: | res://myapp.exe/some.cmd |
which does not really exist. If you extract the name and the extension from this, and the extension is "cmd", then you coiuld treat the name "some" as a command. So you could create an app in VDS that has an interface created in HTML, but uses VDS to provide functionality when you click on some links.
Note that you must specify the name twice on each #RESOURCE line, because by default VDS removes the extension from the resource name, and the extension must be part of the resource name. Also, VDS only allows 8 characters for a resource name (I think the linker uses a fixed size data structure for this) so you only have room for 4 character names plus the extension. This shouldn't matter, because the names are used internally only.
Microsoft Frontpage supports this res:// syntax, so if you use it to create the HTML pages and yoou have the VDS EXE with the compiled-in resources in the same directory, then in the preview pane it will actually display the images etc. taken from the EXE.
Hope this is useful to someone. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Tue Apr 13, 2004 9:39 am Post subject: |
|
|
Very nice Jules!
But why isn't resource type 23 documented in the VDS helpfile?
Regards,
Vic _________________ phpBB Development Team |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Tue Apr 13, 2004 9:51 am Post subject: |
|
|
Quite interesting...
Shouldn't the topic be in "Knowledge Base", though ?
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Apr 13, 2004 10:34 am Post subject: |
|
|
Vic wrote: | Very nice Jules!
But why isn't resource type 23 documented in the VDS helpfile?
|
For the same reason the Windows API isn't documented in it.
The help file does explain that you can have user defined resource types. In fact, I don't think even Microsoft has documented this resource type. It doesn't have a name, as far as I know. I spotted this strange URL format in the text of the "welcome" message from Outlook Express years ago, and thought that one day I would try to find out if it was possible to use it. I only got round to it yesterday, and I found the information using Google, not from any Microsoft documentation. I wasn't even sure, until I tried it, whether this would work with the resources in a VDS executable. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
LOBO Valued Contributor
Joined: 14 Mar 2002 Posts: 241 Location: Wilmington, Delaware, USA
|
Posted: Tue Apr 13, 2004 11:15 am Post subject: |
|
|
Thanks Jules
- Mark |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Apr 13, 2004 12:27 pm Post subject: |
|
|
Really Nice Thanks for the info, I can use this!! _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Tue Apr 13, 2004 1:37 pm Post subject: |
|
|
How can you see which link the user clicked at? It doesn't work with @dlgtext(), since that will return the source of the page...
Code: | external vdsbrw50.dll
DIALOG CREATE,New Dialog,-1,0,477,385
DIALOG ADD,BROWSER,BROWSER1,1,2,473,385,http://www.dialogscript.com,,NONAVIGATE
DIALOG SHOW
:Evloop
wait event
goto @event()
:Browser1NAVIGATE
info You are now here:@cr()@dlgtext(browser1)
goto Evloop
:Close
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Tue Apr 13, 2004 1:42 pm Post subject: |
|
|
And another thing, if I use info @winclass(~BROWSER1) with the Browser1NAVIGATE event, I see weird things like this:
Code: | goto BROWSER1NAVIGATE
SER1NAVIGATE
BROWSER1NAVIGATE
even (and than some kind of @cr() character, I think)
(
\др |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Apr 13, 2004 5:29 pm Post subject: |
|
|
Skit3000 wrote: | How can you see which link the user clicked at? |
Use:
Code: | %U = @browser(Browser,navURL) |
Is there a help file for the browser element? I can't find the commands or functions listed in mine, which is a bit strange, since although it is a separate DLL, that was just for technical reasons: it was always intended to ship as part of the standard VDS package. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Apr 14, 2004 1:43 am Post subject: |
|
|
hi jules,
i too looked for the help file for the browser element and never found it...ggrr!!
serge _________________
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Apr 14, 2004 7:58 am Post subject: |
|
|
I can't find a copy of the original write-up for it, but I can tell you that as well as the usual DIALOG commands the BROWSER element supports the following special BROWSER commands:
Code: | BROWSER <subcommand>, <element name> |
where <subcommand> can be:
BACK, FORWARD, STOP, REFRESH, PAINT, SAVEFILE,LOADFILE, PRINT, PRINTSETUP, PRINTPREVIEW, SELECTALL, COPY
It supports the follwing @BROWSER() functions:
Code: | @BROWSER(<element name>, <arg>) |
where <arg> can be:
NAME - return the title of the currently loaded page;
NAVURL - return the URL it wishes to go to after a <Browser>NAVIGATE event (generated when NONAVIGATE style is set.)
URL - returns current URL
BUSY - returns true/false if browser element is busy.
The element supports the followimg styles, which mostly are used to disable certain types of action.
OFFLINE, NOIMAGES, NOVIDEOS, NOMUSIC, NOSCRIPTS, NOJAVA, NOACTIVEX, NONEWWINDOWS, NOFILEDOWNLOADS, NONAVIGATE
The NONAVIGATE style generates a <Browser>NAVIGATE event if the user clicks on a hyperlink that is not specified as having a different target, you can use this to get VDS to do stuff in response to clicks on links. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Apr 14, 2004 8:32 am Post subject: |
|
|
thanks for that jules
serge _________________
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Apr 14, 2004 11:17 am Post subject: |
|
|
Judging from the example provided DIALOG SET,<element name>,<parameter> can take
special parameters like ONLINE, OFFLINE, and <URL>. Would there be any more, Jules??
Any special params for the other DIALOG commands working with the browser element?
Also @dlgtext(<element name>) grabs the document source..
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Apr 14, 2004 2:32 pm Post subject: |
|
|
jules wrote: | Vic wrote: | Very nice Jules!
But why isn't resource type 23 documented in the VDS helpfile?
|
For the same reason the Windows API isn't documented in it.
The help file does explain that you can have user defined resource types. In fact, I don't think even Microsoft has documented this resource type. It doesn't have a name, as far as I know. I spotted this strange URL format in the text of the "welcome" message from Outlook Express years ago, and thought that one day I would try to find out if it was possible to use it. I only got round to it yesterday, and I found the information using Google, not from any Microsoft documentation. I wasn't even sure, until I tried it, whether this would work with the resources in a VDS executable. |
Jules/Everyone,
This resource type is RT_HTML and Microsoft has documented it at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/introductiontoresources/resourcereference/resourcetypes.asp They just don't document the numeric values. I had to look it up in my LccWin32 header file win.h...
Here is the list and their numeric values...
Code: |
%%RT_ACCELERATOR = 9
%%RT_BITMAP = 2
%%RT_DIALOG = 5
%%RT_FONT = 8
%%RT_FONTDIR = 7
%%RT_MENU = 4
%%RT_RCDATA = $A
%%RT_STRING = $6
%%RT_MESSAGETABLE = $B
%%RT_CURSOR = 1
%%RT_GROUP_CURSOR = $C
%%RT_ICON = 3
%%RT_GROUP_ICON = $E
%%RT_VERSION = 16
%%RT_VXD = 20
%%RT_ANICURSOR = 21
%%RT_ANIICON = 22
%%RT_HTML = 23
%%RT_DLGINCLUDE = $11
%%RT_PLUGPLAY = 19
%%RT_MANIFEST = 24
|
If I get a chance I will see if I can find anymore of them I think this list is missing a few. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|