Using res protocol in MFC
I'm writing an MFC app that uses HTML files as a way to graphically navigate my program menus. I found that you can put html resources into a DLL and access them using the res protocol (which is like the html, ftl, gopher protocols). For example, I can put in my html file
<body background="res://mydll.dll/#2/#131">
And this will read bitmap with resource #131 from mydll and use it as my tiled background. My problem is this only seems to work for predefined types. I want I can add a GIF type to the dll but can't figure out how to reference it. Any chance anyone out there has any example code for this? Thanks
[649 byte] By [
evilduck] at [2007-11-17 14:28:06]

# 1 Re: Using res protocol in MFC
Here is what you do:
The DLL that has your contained HTML can also contain your images. Import your images under the 2110 resource folder. If it has quotes around it then you will need to edit the resource file manually to remove the quotes. By default when you import images, the images are assigned a value and IDR_*. You can replace this with an actual string "background.gif". That way when your HTML file is loaded from the DLL it can reference the images contained there in.
So an example:
You have a DLL called "projectres.dll"
The resources include a tree format as folllows
projectres resources
+ "REGISTRY"
- 2110
"background.gif"
- HTML
"page.html"
Page.html looks something like below
In your MFC project you have a web browser control and you tell it to navigate to "res://projectres.dll/page.html" page.html will then load background.gif from the DLL and whalla you have your graphical resources displayed.
If you are still having troubles, email me and I will reply to this posting with a quick example.
Hope this clears things up,
-Erik