Solved

dynamic HTML with image inside a CHtmlView

Posted on 2004-04-10
6
746 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 122
notReplace  challenge 53 116
sum67 challenge 35 93
twoTwo  challenge 35 93
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now