fwh\samples\lockscrn.prg:
- Code: Select all Expand view
- /*
* Program to view and save Windows 10 LockScreen Images
*
*/
#include "fivewin.ch"
//----------------------------------------------------------------------------//
function Main()
local cPath := GETENV( "userprofile" ) + "\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets\"
local aImages := {}
local oWnd, oBar, oImage, cSave, nImages, n := 1
AEval( DIRECTORY( cPath + "*.*", "H" ), { |a| If( a[ 2 ] < 200000,, ( a[ 1 ] := cPath + a[ 1 ], AAdd( aImages, a ) ) ) } )
ASort( aImages,,,{ |x,y| x[ 2 ] > y[ 2 ] } )
nImages := Len( aImages )
DEFINE WINDOW oWnd STYLE WS_POPUP + WS_MAXIMIZE
DEFINE BUTTONBAR oBar SIZE 32,32 LEFT
oBar:SetColor( CLR_BLACK, CLR_BLACK )
DEFINE BUTTON RESOURCE 0xE112 OF oBar CENTER ACTION ( If( --n < 1, n := nImages, ), oWnd:Update() )
DEFINE BUTTON RESOURCE 0xE111 OF oBar CENTER ACTION ( n := ( n % nImages ) + 1, oWnd:Update() )
DEFINE BUTTON RESOURCE 0xE105 OF oBar CENTER ACTION ( ;
If( !Empty( cSave := cGetFile( "Jpg file(*.jpg)|*.jpg|", ;
"Select File to Save", CurDir(), .t. ) ), ;
HB_MEMOWRIT( cFileSetExt( cSave, "jpg" ), MEMOREAD( aImages[ n, 1 ] ) ), MsgInfo( "Not selected" ) ) )
DEFINE BUTTON RESOURCE FWBitmap( "exit2" ) OF oBar CENTER ACTION oWnd:End()
oBar:Float()
@ 0,0 XIMAGE oImage SOURCE MEMOREAD( aImages[ n, 1 ] ) SIZE 0, 0 OF oWnd NOBORDER UPDATE
oImage:SetColor( CLR_WHITE, CLR_BLACK )
oImage:bLClicked := { || n := ( n % nImages ) + 1, oWnd:Update() }
oImage:bRClicked := { || If( MsgYesNo( "Exit program?" ), oWnd:End(), ) }
oWnd:oClient := oImage
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
//----------------------------------------------------------------------------//
We would be glad to have your comments.