Loading a webpage into a thumbnail

  • Thread starter Thread starter Bob Hollness
  • Start date Start date
B

Bob Hollness

Hi all (me again. I do try to answer the posts I can instead of just
asking!!!)

Any ideas how I could load a webpage into a control that was about the size
of a stamp? I tried a few things but it just put scrollbars on the control
and showed the page as a whole. Basically, I want to scale an image of the
webpage I guess.
 
Hi Bob,

Ive never needed to do that myself (with Html) so im not entirely sure.
We know that the Explorer shell does this quickly and easily so i would be inclined to be looking
through the Win32 to leveredge whatever hooks are availbale there. No sense in reinventing the
wheel.

This article *near* where you want to go but its all in MFC/Com technologies.
http://www.codeproject.com/shell/thumbextract.asp

Beyond that there are a slew of commerical products that do this, the bulk of which seem to use
some form of print driver and then subsequently extracting an image from that.

I dont anticipate it being particularly hard but I can almost guarantee there is no
purely managed way to do this. However i would love to be proved wrong.

;)

Richard
 
Hi Bob,
Any ideas how I could load a webpage into a control that was about the
size of a stamp? I tried a few things but it just put scrollbars on the
control and showed the page as a whole. Basically, I want to scale an
image of the webpage I guess.

There are a couple of ways (as I know of). Firstly is to use MSHTML to
render the page to your desired DC. Or use IShellExtractor to get a
thumbnail of a local HTML file. Although I haven't actually managed to get
the latter to work, and something makes me believe that this feature has
been removed for security purposes, as Explorer doesn't even do it now.

Here is a link on MSHTML that *might* help you.

http://www.devcity.net/forums/topic.asp?tid=85214
^ You'll have to rummage through that one as it's full of a bunch of
people having problems doing as you desire. But I believe it should point
you in the right direction.

http://www.codeproject.com/internet/htmlimagecapture.asp
^ This on the other hand has a working C++ example, sorry it's not .NET
:-(

Nick.
 
Nick,

I never understand how it was done, however now Bop Hollness write it, I get
it.
Get your page in the axwebbrowser
Take that part of screen in a bmp
Set it to a thumbnail using the tumbnail method from gdi
And that is all.

Probably not more than 20 lines of code.

I think I should try this one ones.

However I think that this is more a nice simple chalenge for our Multimedia
Student in my idea

Cor
 
Get your page in the axwebbrowser
Take that part of screen in a bmp
Set it to a thumbnail using the tumbnail method from gdi
And that is all.
That wouldn't work. You'd just end up with a bitmap of a section of the
webpage not a scaled image of the entire web page.
Theres no shrinkToFit method on the Webbrowser, hence Bob comments about
the scroll bars.

Richard
 
Richard Myers said:
That wouldn't work. You'd just end up with a bitmap of a section of the
webpage not a scaled image of the entire web page.
Theres no shrinkToFit method on the Webbrowser, hence Bob comments about
the scroll bars.

Richard

And this was always the problem I came up against!
 
Richard

Why not, in the webbrowser is the complete "page" showed. (Not the used
browser features)

The size of that is not important that is resizable afterwards..

Cor
 
Cor Ligthert said:
Richard

Why not, in the webbrowser is the complete "page" showed. (Not the used
browser features)

The size of that is not important that is resizable afterwards..

Cor

Yeah but if the webpage is 600 pixels high and the webcontrol is only 300 *
300 you end up with a truncated image.
And scrollbars. If you resize your Firefox/IE wndow the page doesn't resize
with it. Even if the web designer has used width="100%".
Which many dont because it can make the page layout look like s**t.

<..>
Do you know how to use the Win32 API Bob?

The basic underhood methodology is to print the webpage but instead of
targeting the printer; you target memory, and then you use that to scale
your image. The actual scaling is the dead easy part,
it just getting the page into a format that you can scale in the first
place, which is not hard, if you use that Interface i
gave you a link too.

Richard
 
place, which is not hard, if you use that Interface i
gave you a link too.

Now ive just gazed up the thread and i couldn;t see the post to which i was
referring to here. I
didn;t mean that first link about MFC but this:
In fact... looks like it will be dead easy.
Using the following Win32 interface
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/p latform/shell/reference/ifaces/ithumbnailcapture/ithumbnailcapture.asp
Richard

Which is really weird. I posted it a number of hours ago. It was in my sent
items folder but
obviously hadn't gone out.... Damn wireless connections.

Richard
 
Hi Richard,
Which is really weird. I posted it a number of hours ago. It was in my
sent
items folder but
obviously hadn't gone out.... Damn wireless connections.

LOL, I'd rather blame the news server or even OE, I've had these issues in
the past. Sometimes I haven't seen my post *but* I've seen ("RE: My
subject") the replies! Weirdness.

Nick.
 
Richard Myers said:
Yeah but if the webpage is 600 pixels high and the webcontrol is only 300
*
300 you end up with a truncated image.
And scrollbars. If you resize your Firefox/IE wndow the page doesn't
resize
with it. Even if the web designer has used width="100%".
Which many dont because it can make the page layout look like s**t.

<..>
Do you know how to use the Win32 API Bob?

The basic underhood methodology is to print the webpage but instead of
targeting the printer; you target memory, and then you use that to scale
your image. The actual scaling is the dead easy part,
it just getting the page into a format that you can scale in the first
place, which is not hard, if you use that Interface i
gave you a link too.

Richard

I tried various methods of this in VB6 and it always just grabbed the part
of screen that was displayed. I did find one example of a guy who did it in
VB6 but when I tried pulling his code apart and then customising it, it
always failed. now, for the life ofe me, i cannot find this webpage again.
if i find it i'll post it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top