forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Embedded HTML apps
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Knowledge Base
View previous topic :: View next topic  
Author Message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Tue Apr 13, 2004 9:21 am    Post subject: Embedded HTML apps Reply with quote

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
View user's profile Send private message Visit poster's website
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Tue Apr 13, 2004 9:39 am    Post subject: Reply with quote

Very nice Jules! Very Happy
But why isn't resource type 23 documented in the VDS helpfile?

Regards,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Apr 13, 2004 9:51 am    Post subject: Reply with quote

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
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Tue Apr 13, 2004 10:34 am    Post subject: Reply with quote

Vic wrote:
Very nice Jules! Very Happy
But why isn't resource type 23 documented in the VDS helpfile?


For the same reason the Windows API isn't documented in it. Wink

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
View user's profile Send private message Visit poster's website
LOBO
Valued Contributor
Valued Contributor


Joined: 14 Mar 2002
Posts: 241
Location: Wilmington, Delaware, USA

PostPosted: Tue Apr 13, 2004 11:15 am    Post subject: Reply with quote

Thanks Jules Very Happy

- Mark
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Apr 13, 2004 12:27 pm    Post subject: Reply with quote

Really Nice Very Happy Thanks for the info, I can use this!! Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Apr 13, 2004 1:37 pm    Post subject: Reply with quote

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... Smile

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
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Apr 13, 2004 1:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Tue Apr 13, 2004 5:29 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Apr 13, 2004 5:30 pm    Post subject: Reply with quote

I do have the DLL (it's in the /redist/ folder), but I have never seen any documentation about it... Sad Maybe you still have some code lying around with all functions and commands in it? Smile
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Apr 14, 2004 1:43 am    Post subject: Reply with quote

hi jules,

i too looked for the help file for the browser element and never found it...ggrr!!

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Apr 14, 2004 7:58 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Apr 14, 2004 8:32 am    Post subject: Reply with quote

thanks for that jules Smile

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Apr 14, 2004 11:17 am    Post subject: Reply with quote

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
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed Apr 14, 2004 2:32 pm    Post subject: Reply with quote

jules wrote:
Vic wrote:
Very nice Jules! Very Happy
But why isn't resource type 23 documented in the VDS helpfile?


For the same reason the Windows API isn't documented in it. Wink

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Knowledge Base All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group