a command like PRINTFORM that saves as bmp file

Posted on 2006-03-28
Last Modified: 2010-05-18
I need a command similar to PrintForm that will save my screen to a file on my hard drive called something like x.bmp.

My High School tests show the results of the student's test on the screen and the screen is sent to the printer with the following in a command object called "PRINT".


I would now like to save a copy of this test on the hard drive in a folder called "PRINTOUTS". These would have sequential filenames like 1.bmp, 2.bmp etc.

There must be a simple way to save the screen as a bmp file from visual basic.
The PrintScreen key seems to do this, so there must be a simple command from vb for it.

I use visual basic 4 bacause it meets my needs and I am comfortable with it. I have VB6 but feel awkward and slow with it.
Question by:HowardAppel
    LVL 85

    Accepted Solution

    Microsoft has a great project in their Knowledge Base that does screenshots via API's only...

    The routines in the example can:

    Capture the entire contents of a form.
    Capture the client area of a form.
    Capture the entire screen.
    Capture the active window on the screen.
    Capture any portion of any window given a handle to it.
    Create a Picture object from a bitmap and a palette.
    Print a Picture object as large as possible on the page.

    It can be found here:;en-us;161299&Product=vb6

    To save the captured area, use the SavePicture() function:

    LVL 15

    Expert Comment

    SavePicture Clipboard.GetData(vbCFBitmap), strFile
    LVL 15

    Expert Comment

    place this on the keydown event of a form or a command button.

    if keycode = vbkeyprint then
         SavePicture Clipboard.GetData(vbCFBitmap), strFile
    end if
    LVL 15

    Expert Comment

    strfile is the path where you want to put file including its name:
    for example

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    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…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now