Kent Belan wrote:
> Hello,
> Anyone know how to add a "Print Screen" option in a VFP9 app ?
> Thanks,
> Kent
>
>
Absolutely! I got this from VFPX iirc, courtesy Cesar on Foxite. I
have a form where I capture the user's comment and email them to me
along with a zip of screenshots of all open forms. Here's the form.load
code that captures the screenshots and puts them into a zip that is
later emailed via other code:
DODEFAULT()
#DEFINE HKEY_CURRENT_USER -2147483647 && BITSET(0,31)+1
LOCAL loGdiPlusX as Object, lcKey as String, lnError as Integer,
loRegistry as Object, loException as Exception, ;
lcValue as String, loCaptureBmp AS xfcBitmap, loForm as Form, n
as Integer, lcCmd as String
TRY
loGdiPlusX = newobject("xfcSystem", ".\classes\system.vcx")
*loBmp = loGdiPlusX.Drawing.Bitmap.FromScreen()
*you can also use this syntax to capture the current form
*loBmp = loGdiPlusX.Drawing.Bitmap.FromScreen(Thisform)
*or this syntax to capture the vfp screen area
*loBmp = loGdiPlusX.Drawing.Bitmap.FromScreen(_screen)
*loBmp.Save("ScreenCapture.jpg",
loGdiPlusX.Drawing.Imaging.ImageFormat.Jpeg)
* clear out any previous screenshots
ERASE CapturedForm*.*
* mjb 06-01-07 taken form Cesar Chalom's publishing on Foxite
n = 1
FOR EACH loForm IN _Screen.Forms
loCaptureBmp = loGdiPlusX.Drawing.Bitmap.FromScreen(loForm.HWnd)
loCaptureBmp.Save("CapturedForm" + TRANSFORM(n) + ".png",
loGdiPlusX.Drawing.Imaging.ImageFormat.Png)
n = n + 1
ENDFOR
lcCmd = [RUN /N 7za.exe a -tzip screenshots.zip CapturedForm*.png
-ppwd!] + JUSTSTEM(LOWER(oUtils.cAppName))
&lcCmd
this.lAttachImage = .T.
lcKey = "Software\MB Software Solutions\" + JUSTSTEM(oUtils.cAppName)
lcValue = SPACE(100)
loRegistry = NEWOBJECT("registry",".\classes\registry.vcx")
lnError =
loRegistry.GetRegKey("SupportEmail",@lcValue,lcKey,HKEY_CURRENT_USER)
IF NOT EMPTY(lcValue) THEN
this.cEmailaddress = ALLTRIM(lcValue)
ENDIF && NOT EMPTY(lcValue)
CATCH TO loException
this.lAttachImage = .F.
FINALLY
ENDTRY
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.