Print Page | Close Window

Capturing an image of a webpage ?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Active-X COM Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=12313
Printed Date: 06 May 2024 at 7:43am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Capturing an image of a webpage ?
Posted By: Lodep59
Subject: Capturing an image of a webpage ?
Date Posted: 02 October 2008 at 2:30am
Hello,
 
Did someone know how to create an image of a webpage from a webbrowser (Ms or Cj) ?
 
I try to create a thumbnail of a webpage shown in a WB but no way for the moment...
 
Any idea ?



Replies:
Posted By: Oleg
Date Posted: 02 October 2008 at 4:11am

google + "Screenshot of Web Page in VB" will help.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Lodep59
Date Posted: 02 October 2008 at 4:27am
Originally posted by oleg oleg wrote:

google + "Screenshot of Web Page in VB" will help.

 
Already done that dear Oleg.
But all i've found is for asp.net ou .net in general, not for VB6...


Posted By: Mr.Den
Date Posted: 02 October 2008 at 11:53am
To do a screenshot in VB6, I use a Pegasus activex control for the picture container, but you should be able to change the code to use a picturebox:
 
Put this code in the declarations of a form

        'print screen
        Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
        ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Put this code in a sub:
 
        'call the Windows keybd_event sub, passing the built-in
        'VB keyboard constant vbKeySnapshot (44) to the sub.
       
        'The four parameters for keybd_event are:
        'BYTE bVk           'virtual-key code
        'BYTE bScan         'hardware scan code
        'DWORD dwFlags      'flags specifying various function options
        'DWORD dwExtraInfo  'additional data associated with keystroke
       
        'The second parameter (bScan) determines what
        'to copy... passing 0& copies the screen or
        'passing 1& copies the active form.
       
        keybd_event vbKeySnapshot, 0&, 0&, 0&
        
        'pause to let Windows update the clipboard
        DoEvents
        
        'retrieve the clipboard bitmap to the control
        obPix.Picture = Clipboard.GetData(vbCFBitmap)
       
        obPix.SaveFileType = 8
        obPix.SaveJPGChromFactor = 12 
        obPix.SaveJPGLumFactor = 15 
        obPix.SaveJPGSubSampling = SS_111
        
        obPix.SaveFileName = "C:\Test.jpg"
       
        obPix.SaveFile


Posted By: Oleg
Date Posted: 03 October 2008 at 1:57am

Hi,

try convert this project from C# to VB - http://www.codeproject.com/KB/graphics/IECapture.aspx - http://www.codeproject.com/KB/graphics/IECapture.aspx


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Lodep59
Date Posted: 03 October 2008 at 3:23am
Mr Den : Thank you, but if the webpage is very long the screenshot will not take all the web page.
 
Oleg : I'll try but don't think it's possible, C# to VB6 is a very hard conversion :( Perhaps you can add this functionnality to your web browser control ?
 
Thank you for all !



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net