Wiki Home

Snag All Pages


Namespace: VFP
* SnagAllPages.prg
* Makes screen shots of a form,
* one for each page of all the page frames it can find

* By Carl Karsten

#DEFINE ANIMCMD "P:\html\temp\b\mkAnim.sh"

Local ;
	loForm as Form

Set Path to D:\foxbin\bmpstuff\bmp4
SET LIBRARY TO Home(0) + "FoxTools.FLL" ADDITIVE
SET CLASSLIB TO scrnprnt.vcx ADDITIVE	
oCap = CREATEOBJECT("CaptureScreen")
StrToFile( "convert -delay 150 -colors 256 ", ANIMCMD, 0 )

Activate Screen
clear
For each loForm in _Screen.Forms
	dig( loForm, loForm.Name, loForm.HWnd, 0 )
EndFor

StrToFile( "Form1.gif", ANIMCMD, 1 )

Return

Function dig( toContainer as Container, tcObjName, thWnd, tnCnt )
Local ;
	loObj as Object, ;
	lnObj
	
* If tnCnt<>1
	lcFileName = ForceExt(tcObjName, "BMP" )
	lnRetVal = oCap.CaptureWindow( thWnd, "P:\html\temp\b\" + lcFileName )
	StrToFile( lcFileName + " ", ANIMCMD, 1 )
* EndIf

* ? tcObjName
* If PemStatus( toContainer, "activate", 5 )
*	toContainer.activate()
* EndIf
Do case

	Case toContainer.BaseClass == "Form"
		toContainer.show()
		toContainer.activate()
		toContainer.Refresh()
		
	Case toContainer.BaseClass == "Page"
		* toContainer.Parent.activepage = toContainer.PageOrder
		toContainer.Parent.activepage = tnCnt
		
EndCase

* lnCnt = 0
* For each loObj in toContainer.Objects
*	lnCnt = lnCnt + 1

For lnObj = 1 to toContainer.Objects.Count

	Do case
	
		Case toContainer.BaseClass == "PageFrame"
			* If we are looking at pages, find the N'th page, which is retarded.
			For each loPage in toContainer.Objects
				If loPage.PageOrder = lnObj
					loObj = loPage
					Exit
				EndIf
			EndFor
			
		Otherwise
			loObj = toContainer.Objects( lnObj )
	
	EndCase

	If InList( loObj.baseclass, "Pageframe", "Page" )
		dig( loObj, tcObjName + "_" + loObj.name, thWnd, lnObj )
	EndIf

EndFor

If 	toContainer.BaseClass == "Pageframe"
	toContainer.activepage = 1
EndIf

Return

Category Code Samples
( Topic last updated: 2005.05.24 10:41:26 PM )