Usually modern applications use standard way to create user interface using buttons, windows and other controls. Considering the growing Internet usage these days it is possible to suppose that end-users spend a lot of time browsing web sites. So it could be a good idea to offer them new applications with user interface built using HTML.
More at all, it is very easy!
Let's describe using of HTML resources stored inside Resource-Only-DLL:
- Run Resource Builder and in menu select Resources | Add new type | HTML:
Figure 1. Adding HTML resource.
- Define the name for resource as SAMPLE.HTML in appeared dialog and click OK button.
- Double-click on SAMPLE.HTML resource in resource tree and type the following HTML code in appeared editor:
So you will see the following on your screen:
<title>Sample HTML file for res:\\ protocol.</title>
Figure 2. HTML resource sample.
- Add another HTML resource with LOGO.PNG name and load it from the PNG file on your disk.
- Select in Resource Builder menu Tools | Create Resource-Only-DLL and specify the file name for DLL.
- Run your Internet browser and type the following in address bar:
and click Go button.
- You will see something like the following in your browser:
Figure 3. HTML resources in DLL and res:// protocol.
As you see there is nothing difficult!
We've just demonstrated the usage of HTML resources stored in Resource-Only-DLL. Let's try to use HTML resources inside our EXE itself.
Create simply application containing one window and WebBrowser control on it. Add the following code to the application start-up code to navigate WebBrowser control to HTML page stored in executable resources:
WebBrowser1.Navigate('res://' + Application.ExeName + '/sample.html'); (Pascal code)
After application run we will see the following:
Figure 4. Starting application without HTML resources.
Let's modify our RC file created earlier, compile it to RES and add to our project. If we run our application after recompilation we will see the following:
Figure 5. Application with HTML resources.
As you can see we can use links to another HTML resources stored inside our EXE (as well as inside other modules). This allows us to create any user interface we want using the HTML code.
More at all, using Resource Builder we can modify HTML and graphical resources of our application even without recompilation. This brings us the powerful and easy solution to update and improve our application as well as to create customized or localized builds.
You can download the sample source code and resources from: https://www.resource-builder.com/files/res_protocol.zip
Read more at: https://www.resource-builder.com
Download the trial version at: https://www.resource-builder.com/download.html