Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP SCREEN CAPTURE UNDER PROGRAM CONTROL

Status
Not open for further replies.

JERRYFOOTE

Programmer
Aug 5, 2002
8
US
I need to capture a vfp form that I draw on using the shape control, after I finish drawing i want to triger a screen capture, write that capture image to a file and then print a form that has as a source the file just captured.
So exactly how do I capture the screen?
 
GDIPlusX can do this for you. This is a free community-developed library that you can download from:

The code is very simple:

Code:
DO system.app
loImage = _SCREEN.System.Drawing.Bitmap.FromScreen(lnHwnd)
loImage.Save("MyImage.JPG", ;
 _SCREEN.System.Drawing.Imaging.ImageFormat.JPEG)

The first of the above lines stores an object reference to the main GDIPlus class in _Screen.

The second lne then uses that object to grab the screen shot. In this example, lnHwdn is the handle of the VFP form that you want to capture. You can get it form the form's hWnd property. If you want to capture the entire screen, use _Screeen.hWnd.

The third line saves the image to a file named MyImage.JPG in JPEG format. Yu can save in other formats as well.

I use this technique in one of my own applications. It works very well.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top