Hello Michael
Thanks for the code. I had just worked on another project to
resize jpg images with GDIPlusX and was able to use your code
and my code to create a real nice and very easy print screen
function.
It works great,
Thanks again,
Kent
Here is the code:
In the main form init:
* Load GDIPlusX Library
do system.app
In my procedure file:
function RockPrintScreen
local loBmp, lcScreenCapture, lnArea
lcScreenCapture = oApp.TempPath + "ScreenCapture.jpg"
WITH _SCREEN.System.Drawing
* Variables to store the new Image size
* loBmp = .Bitmap.FromScreen()
*you can also use this syntax to capture the current form
* loBmp = .Bitmap.FromScreen(Thisform)
*or this syntax to capture the vfp screen area
loBmp = .Bitmap.FromScreen(_screen)
* Save to JPG File
loBmp.Save(lcScreenCapture, .Imaging.ImageFormat.Jpeg)
ENDWITH
if file(lcScreenCapture)
messagebox('Screen Print - Just before Report',48,'Debug')
lnArea = select(0)
select 0
create cursor scrnprnt (temp C(1))
select scrnprnt
append blank
replace temp with 'X'
report form ScreenPrint noconsole to printer prompt
use in scrnprnt
select (lnArea)
endif
return
endfunc
>
>
> 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.