a command like PRINTFORM that saves as bmp file

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.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
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:

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SavePicture Clipboard.GetData(vbCFBitmap), strFile
place this on the keydown event of a form or a command button.

if keycode = vbkeyprint then
     SavePicture Clipboard.GetData(vbCFBitmap), strFile
end if
strfile is the path where you want to put file including its name:
for example
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.