Solved

dynamic HTML with image inside a CHtmlView

Posted on 2004-04-10
6
757 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

776 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