?
Solved

VB6 - Save invisible form1 as image to c:\

Posted on 2011-09-24
7
Medium Priority
?
463 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:kidd12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 11

Expert Comment

by:kbirecki
ID: 36595365
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.
0
 

Author Comment

by:kidd12
ID: 36595915
no problem if is pdf, PDF or BMP is good for me. thanks
0
 
LVL 11

Accepted Solution

by:
kbirecki earned 2000 total points
ID: 36598452
OK, I misunderstood at first when you referenced the web browser contorl.  I thought you only wanted to capture the contents of the web browser control.  You want the whole form, so it doesn't really matter that there is (or is not) any particular control on the form, right?

Here's a project that will take a snapshot of the current form to a BMP file.  There are comments in the source code and references to sources for some of the code.  There is also a comment in the form source code to a site with sample code to convert BMP to JPG if you want to compress the file to save space or transmission time.

This sample project captures the current form including all contents to the clipboard, and then saves it to a BMP file in the application folder.
DemoSaveFormToImageFile.zip
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:kbirecki
ID: 36598469
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.
0
 
LVL 11

Expert Comment

by:kbirecki
ID: 36598494
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.
0
 
LVL 11

Expert Comment

by:kbirecki
ID: 36598513
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.
0
 

Author Closing Comment

by:kidd12
ID: 36601911
thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 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