Click here to Skip to main content
15,891,976 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Name of offending code Pin
Christian Graus31-Jul-07 23:54
protectorChristian Graus31-Jul-07 23:54 
GeneralRe: Name of offending code Pin
Johan Hakkesteegt1-Aug-07 20:02
Johan Hakkesteegt1-Aug-07 20:02 
AnswerRe: Name of offending code Pin
Steven J Jowett31-Jul-07 23:58
Steven J Jowett31-Jul-07 23:58 
GeneralRe: Name of offending code Pin
Johan Hakkesteegt1-Aug-07 20:00
Johan Hakkesteegt1-Aug-07 20:00 
AnswerRe: Name of offending code Pin
Luc Pattyn1-Aug-07 0:27
sitebuilderLuc Pattyn1-Aug-07 0:27 
GeneralRe: Name of offending code Pin
Johan Hakkesteegt1-Aug-07 19:59
Johan Hakkesteegt1-Aug-07 19:59 
QuestionError when display report in crystal report viewer Pin
Mekong River31-Jul-07 22:56
Mekong River31-Jul-07 22:56 
QuestionC# code to vb.net Pin
Ahmad Zaidi31-Jul-07 22:00
Ahmad Zaidi31-Jul-07 22:00 
Hi,

I was trying to take a screenshot of a web page through the web browser control using the drawtobitmap function and it was giving blank images for pages such as google.com . I finally found the reason as stated by someone here :
http://www.codeproject.com/useritems/Website_Thumbnails_in_C_.asp?df=100&forumid=359744&exp=0&select=2053785#xx2053785xx

I am now trying to convert the code given by the guy to vb.net, but am new to it and cant seem to implement the interface calls. Could anyone please help he port the code? Here it is (as given in the post):

"The only sure fire way round I found was to fall back to using the raw interfaces:

1) Add a reference to MSHTML.tlb

2) Create your own version of IHTMLElementRender which uses an IntPtr rather than _RemotableHandle:


[InterfaceType(1)]
[Guid("3050F669-98B5-11CF-BB82-00AA00BDCE0B")]
public interface IHTMLElementRender2
{
void DrawToDC(IntPtr hdc);
void SetDocumentPrinter(string bstrPrinterName, ref _RemotableHandle hdc);
}


2) Use this code to capture the initial web page image:


IHTMLDocument2 rawDoc = (IHTMLDocument2)hiddenWebBrowser.Document.DomDocument;
IHTMLElement rawBody = rawDoc.body;
IHTMLElementRender2 render = (IHTMLElementRender2)rawBody;

Bitmap screenCapture = new Bitmap(width, height);
Rectangle drawRectangle = new Rectangle(0, 0, width, height);
myWebBrowser.DrawToBitmap(screenCapture, drawRectangle);
Graphics graphics = Graphics.FromImage(screenCapture);

IntPtr graphicshdc = graphics.GetHdc();
render.DrawToDC(graphicshdc);
bmpg.ReleaseHdc();
bmpg.Dispose();"

Thanks!
Ahmad
AnswerRe: C# code to vb.net Pin
Christian Graus31-Jul-07 22:02
protectorChristian Graus31-Jul-07 22:02 
AnswerRe: C# code to vb.net Pin
eyes200731-Jul-07 22:10
eyes200731-Jul-07 22:10 
GeneralRe: C# code to vb.net Pin
Ahmad Zaidi31-Jul-07 22:18
Ahmad Zaidi31-Jul-07 22:18 
Questionmove the toolbar in program Pin
eyes200731-Jul-07 20:58
eyes200731-Jul-07 20:58 
AnswerRe: move the toolbar in program Pin
Tom Deketelaere31-Jul-07 21:20
professionalTom Deketelaere31-Jul-07 21:20 
GeneralRe: move the toolbar in program Pin
eyes200731-Jul-07 22:26
eyes200731-Jul-07 22:26 
GeneralRe: move the toolbar in program Pin
Tom Deketelaere1-Aug-07 0:12
professionalTom Deketelaere1-Aug-07 0:12 
GeneralRe: move the toolbar in program Pin
eyes20071-Aug-07 1:00
eyes20071-Aug-07 1:00 
GeneralRe: move the toolbar in program Pin
Tom Deketelaere1-Aug-07 1:11
professionalTom Deketelaere1-Aug-07 1:11 
GeneralRe: move the toolbar in program Pin
eyes20071-Aug-07 2:30
eyes20071-Aug-07 2:30 
GeneralRe: move the toolbar in program Pin
Tom Deketelaere1-Aug-07 3:06
professionalTom Deketelaere1-Aug-07 3:06 
GeneralRe: move the toolbar in program Pin
~V~1-Aug-07 2:55
~V~1-Aug-07 2:55 
General[Message Deleted] Pin
~V~1-Aug-07 2:56
~V~1-Aug-07 2:56 
GeneralRe: move the toolbar in program Pin
Rupesh Kumar Swami1-Aug-07 3:09
Rupesh Kumar Swami1-Aug-07 3:09 
GeneralRe: move the toolbar in program Pin
eyes20071-Aug-07 3:13
eyes20071-Aug-07 3:13 
GeneralRe: move the toolbar in program Pin
Tom Deketelaere1-Aug-07 3:48
professionalTom Deketelaere1-Aug-07 3:48 
GeneralRe: move the toolbar in program Pin
eyes20071-Aug-07 4:21
eyes20071-Aug-07 4:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.