Link to home
Start Free TrialLog in
Avatar of kidd12
kidd12

asked on

VB6 - Save invisible form1 as image to c:\

hello friends, i am have a invisible form and i am need save this to image, in this have webbrowser, i am need save for display contents in webbrowser as image in c:\
i am tried
Set Picture1.Picture = CaptureForm(Me)
 SavePicture Picture1.Image, "c:\img.bmp"
with no success, i am need save the form and webbrowser as image in invisible.
Avatar of kbirecki
kbirecki
Flag of United States of America image

Does it have to be a BMP file?  I haven't tried the first part, but maybe you could automate printing the page to a PDF file, and then use ImageMagick to convert from PDF to BMP.

Or another idea would be to use a web browser control on your form, with the web browser object setting .visible=false, and then print that.  Again, I haven't tried printing a web browser control, but it might be another avenue to try.
Avatar of kidd12
kidd12

ASKER

no problem if is pdf, PDF or BMP is good for me. thanks
ASKER CERTIFIED SOLUTION
Avatar of kbirecki
kbirecki
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I forgot to mention that to do this, the form has to be visible, but you can move it off screen so it is not displayed and then use these concepts to capture it.
Oops, you'll have to do this in reverse.  If you move the form off screen, the capture process will grab some of the desktop instead of the form.  Since your form is already invisible, I'd suggest making it briefly visible during the capture.  At the beginning of the capture process, make your form visible (or bring it on screen), do the capture as shown in the demo project above, then make your form invisible again (or move it off screen).  I think it will go so fast no one will see it.

Let me know how it goes.
Also, I just noticed I left a "Debug.Print Now & " busy"" statement in the btnGo_Click routine.  You'll probably want to comment that out.
Avatar of kidd12

ASKER

thanks