#include "fivewin.ch"
function Main
private oWnd, oFrg, oTm
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd ON INIT (ShowWindow(oWnd:hWnd,3), Frg_Sel())
return nil
procedure Frg_Sel
local oCl
if valtype(oFrg)!="O"
DEFINE DIALOG oFrg FROM 0,0 TO 300,300 PIXEL ;
STYLE nOR(WS_POPUP, WS_THICKFRAME) ;
COLOR CLR_BLACK, RGB(152, 251, 152) RESIZABLE
ACTIVATE DIALOG oFrg ON INIT oFrg:nOpacity:=100 NOWAIT CENTER
oFrg:Move(400, 600, 300, 300)
SetWindowPos(oFrg:hWnd,-1,0,0,0,0,3)
oFrg:bLDblClick:={||Frg_Cut()}
oFrg:bRClicked:={||oWnd:End()}
oFrg:Cargo:={0, 0, .F., {}}
oFrg:bLClicked := { | nRow, nCol | oFrg:Cargo[1]:= nRow, oFrg:Cargo[2]:= nCol, ;
oFrg:Cargo[3] := .T., oFrg:oCursor := cursorhand() }
oFrg:bMMoved = { | nRow, nCol | iif( oFrg:Cargo[3], oFrg:Move( oFrg:nTop + ;
nRow - oFrg:Cargo[1], oFrg:nLeft + nCol - oFrg:Cargo[2],,, .T. ),) }
oFrg:bLButtonUp := { || oFrg:Cargo[3] := .F., oFrg:oCursor := nil }
else
oFrg:Show()
endif
Chk_Frg()
return
procedure Frg_Cut
local hBmp
RELEASE TIMER oTm
oFrg:Cargo[3] := .F.
oFrg:oCursor := nil
syswait(0.1)
oFrg:Hide()
SendKey(VK_SNAPSHOT)
syswait(0.1)
OpenClipboard (getdesktopwindow())
hBmp:= GetClpData(2) // CF_BITMAP
CloseClipboard()
? hBmp
DeleteObject(hBmp)
Frg_Sel()
return
procedure Chk_Frg //always in the foreground
if valtype(oTm)!="O"
oWnd:Hide()
SetWindowPos(oFrg,-1,0,0,0,0,3)
DEFINE TIMER oTm OF oWnd INTERVAL 1000 ACTION Chk_Frg()
oTm:Activate()
endif
SetForeGroundWindow(oFrg)
return