Would like some IncludeBinary Advice...

Just starting out? Need help? Post your questions and find answers here.
User avatar
blueb
Addict
Addict
Posts: 1044
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Would like some IncludeBinary Advice...

Post by blueb »

I'm trying to create a Help viewer program using a WebGadget() as a base.

A 'RTF HelpViewer' that I created earlier... ran well on Win 10.

see: viewtopic.php?p=531653#p531653

But because some Win 7 and Win XP users were having resizing issues with the EditorGadget(), 'srod' suggested a WebGadget() might be preferable.

-------------

So, I'd like to include the web pages directly in my HelpViewer.exe, so the user doesn't have multiple files to contend with... only the EXE itself.

As it is now, the only way I can actually view the HTM files is to copy the binary included file to the EXE's directory. This will lead to the user having to view a lot of HTM file, etc in their folder.

As a simple example...

Code: Select all

DataSection
 Web1: 
   IncludeBinary "EggShell.htm" 
 Webend1: 
EndDataSection
; Then extract the files: 
If CreateFile(0, "EggShell2.htm") 
  WriteData(0, ?Web1, ?Webend1- ?Web1)
  CloseFile(0) 
EndIf
Any ideas for having an EXE program view the included web pages, without physically planting them in a users folder?
Or do I go with the above method, and wipe the files on exit?

Thanks :)
- It was too lonely at the top.

System : PB 6.10 LTS (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
macros
User
User
Posts: 80
Joined: Wed Mar 15, 2006 1:47 pm
Location: Munich

Re: Would like some IncludeBinary Advice...

Post by macros »

Under Windows you can use
SetGadgetItemText() with #PB_Web_HtmlCode
https://www.purebasic.com/documentation ... adget.html

Load the text similar to your WriteData() with PeekS()

This comes with a bit of effort:
If your pages are linked between each other you have to create a NavigationCallback and intercept the new url$ by replacing the webgadget content.
Also you are restricted to Windows because under Linux the SetGadgetItemText() with #PB_Web_HtmlCode does not work.

If you want to be incredibly fancy you can run a small local webserver and serve the sites to you gadget to have a cross-platform solution.
This may however trigger firewalls, so I wouldn't recommend it.
User avatar
blueb
Addict
Addict
Posts: 1044
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Would like some IncludeBinary Advice...

Post by blueb »

Thanks for the ideas macros. :)
- It was too lonely at the top.

System : PB 6.10 LTS (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Post Reply