We help IT Professionals succeed at work.

Want to be able to capture a non foxpro window to a file (bmp)

busycoder
busycoder asked
on
I want to be able to do what alt-print screen does, and I can do this if it is a foxpro form, but not if the window is outside of foxpro. i would also like to be able to capture a part of a screen if I pass the coordinates to capture.
Comment
Watch Question

CERTIFIED EXPERT

Commented:
So if you would like to capture a non-FoxPro window or a part of the screen from VFP program then you could use some SnagIt API or SnagIt COM Server (http://assets.techsmith.com/docs/pdf-snagit/Snagit-11-COM-Server-Documentation.pdf) or some other similar software.

You may also call PrintWindowAPI directly: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162869(v=vs.85).aspx 

It is also described here: http://www.news2news.com/vfp/?example=158
Software Developer
CERTIFIED EXPERT
Commented:
Use GDIPlusX from VFPX at Codeplex. Then it's three lines:

DO (LOCFILE("system.app"))
oBMP = _SCREEN.System.Drawing.Bitmap.FromScreen(_SCREEN.HWnd)
oBmp.Save("screen.bmp",.Imaging.ImageFormat.Bmp)

Put in 0 instead of _SCREEN.HWnd to get the a desktop screenshot, or any windows hwnd for any other applications window. You can also save as PNG or JPG, anything Windows GDI+ supports.

You can of course cut out an area before saving, etc. GDIPlusX comes with samples helping you to do more, as you like.

Bye, Olaf.

Author

Commented:
Very cool stuff I can't believe I haven't run across this yet. Thanks a ton!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.