Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using dibapi32 to create an image from a form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01577625
Message ID:
01577630
Vues:
83
I can give you a DLL that will save the screen automatically if you like. It may already be a component of my Realtime project. I can't remember. If not, it's easy to add. It would be used in code something like this:
* Somewhere in startup, need whatever.dll in .\exe\ directory
DECLARE INTEGER saveFormAsImage IN exe\whatever.dll INTEGER nHwnd, STRING cFilename, INTEGER nFilenameLength

lcFile = "c:\temp\myfile.bmp"
saveFormAsImage(thisForm.hwnd, lcFile, LEN(lcFile))
https://github.com/RickCHodgin/Realtime
Look at realtime.dll and realtime.vcx for the API. I think one of those functions saves the form's hwnd as bitmap, or a rectangle from it. I can't remember.

My code only saves as 24-bit BMP. It could be extended to save in other formats.

Best regards,
Rick C. Hodgin


>Hi
>
>I am using dibapi32 to create an image from a form - it work beautifully with the following code but there is one problem it doesn't save the file automatically - the operator has to press save - that's not what i want - any ideas how to save the image automatically ?
>
>*FORM/SCREEN CAPTURE TO BMP FILE:
>*!* make FoxTools available
>SET LIBRARY TO c:\global\FoxTools.FLL ADDITIVE
>*!* make the class library available
>SET CLASSLIB TO scrnprnt.vcx ADDITIVE
>oCap = NEWOBJECT("capturescreen", "scrnprnt") && Create instance of Screenprint
>
>
>
>*!* Capturing the active VFP form
>lnRetVal = oCap.CaptureForm( "file.bmp" )
>release oz2W
>return
>* calling
>*=printscr()
>
>
>function printscr()
>
> DECLARE INTEGER GetDesktopWindow IN Win32api
>
> DECLARE INTEGER PrintWindow IN DibApi32 ;
> INTEGER HWnd, ;
> INTEGER fPrintArea, ;
> INTEGER fPrintOpt, ;
> INTEGER wxScale, ;
> INTEGER wyScale, ;
> STRING @ szJobName
>
> LOCAL nRetVal,cJobName && title you want to show when printing
>
> cJobName = 'Current Screen' && or whatever - this could be passed in as a parameter, also.
>
> nRetVal = PrintWindow(GetDesktopWindow(),1,1,0,0,@cJobName)
> IF nRetVal != 0
> IF nRetVal != 6 && 6 = User canceled printing
> MESSAGEBOX("Unable to print the window" + chr(10) + ;
> "See System Administrator " + STR(nRetVal),48, ;
> "")
> ENDIF
> ENDIF
>
>RETURN
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform