Solved

dynamic HTML with image inside a CHtmlView

Posted on 2004-04-10
6
777 Views
Last Modified: 2013-11-20
Hi,

I am trying to dynamically display a HTML page inside a static picture window. I am using the IDispatch and IHTMLDocument2 interfaces to load the HTML from memory.

At this point, I can display HTML text, tables, etc. but not image resources. If I send a HTML string like <img src="file:///C|/test.jpg" width="201" height="125">, the page is able to find the image on the disk and displays it correctly.

However, my goal is to have the image as a resource in my project and not as a seperate file because i need to distribute the executable file to many people and dont want to give an extra image file.

Can I make the HTML page display images that are resources in my project ?

Thanks
bk
0
Comment
Question by:bkfirebird
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
caner_elci earned 350 total points
ID: 10800176
your URL will be something like this:  res://yourapplication.exe/test.jpg

and you will need to import your jpg as "2110" to your application's resources.. That is:

Go to ResourceView, right click, Import, select your .jpg file.. It will ask you the resource type, enter "2110" there.. and Visual Studio will import your image.. Its resource name will be something like IDR_21101.. change it to your picture's name.. just like "sample.jpg" (be careful, use the quotes or you will not be able to access it by res:// locator)

Caner ELCI
0
 
LVL 4

Expert Comment

by:caner_elci
ID: 10800183
By the way, I forgot to tell you about HTML pages... "2110" for image resources.. HTML for html resources.. it's currently known by Visual Studio.. You'll see that in ResourceView. If you can't see, just import some html file and it will be visible as a group.

But, again, name your html pages with quotes, just like "about.html"
0
 
LVL 4

Author Comment

by:bkfirebird
ID: 10800220
Thanks a lot caner_elci .... that worked.

just one thing, the quality of the resource image is much worser than when the image is a outside file ... do you know why ?

where can i read more about these "2110" resources ?


thanks again
bk
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:caner_elci
ID: 10800233
Well, in fact there is nothing to do with the quality, because it only imports your image as a resource. So, image remains the same, but there may be a difference between res:// and file:// in their implementation.. You can try converting your image to a loseless format such as gif or png...

I also did a google search, this sample may help you : http://www.codeproject.com/tips/res.asp 
download the source and take a look at it..
0
 
LVL 4

Author Comment

by:bkfirebird
ID: 10800243
thanks a lot ... you've been a great help
best regards,
bk
0
 
LVL 4

Expert Comment

by:caner_elci
ID: 10800245
you're welcome.. have a nice coding..
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Is it possible to combine several text files into one big one? (redhat v5 enterprise) 4 115
xyBalance chalenge 58 105
ODBC Connection Logging, ADO.NET 6 73
fizzArray  challenge 1 115
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question