hi everyone,
Is possible copy the content of metafile to clipboard of Windows ?
regards
MetaFile to ClipBoard
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Yuri,
Yes, the Windows clipboard supports metafiles by default. Please add this method to FWH Class TClipboard:
Yes, the Windows clipboard supports metafiles by default. Please add this method to FWH Class TClipboard:
Code: Select all
#define CF_ENHMETAFILE 14
METHOD SetMetaFile( oMetaFile ) CLASS TClipBoard
local lResult := .f.
if ::Open()
EmptyClipboard()
lResult = SetClipboardData( CF_ENHMETAFILE, oMetaFile:hMeta )
lResult := ::Close() .and. lResult
endif
return lResult
Hi Antonio,
thanks for your suport...
Folowing your instructions, i add the method SetMetaFile() on TClipBoard class...
By suposition, i created another method, GetMetaFile():
For test it, I changed my RPreview function this way:
Doesn´t work . Is the code correct ?
Gracias Antonio
saludos
thanks for your suport...
Folowing your instructions, i add the method SetMetaFile() on TClipBoard class...
By suposition, i created another method, GetMetaFile():
Code: Select all
method GetMetaFile()
local hMetaFile := 0
if ::Open()
hMetaFile = GetClpData( CF_ENHMETAFILE )
::Close()
endif
return hMetaFile
Code: Select all
oMeta1:bRClicked := {|nRow,nCol| SelMeta(oMeta1) }
static Function SelMeta(oMeta)
local oClp:=TClipBoard():New( CF_ENHMETAFILE )
oClp:SetMetaFile( oMeta )
MSGINFO( oClp:IsEmpty() ) => returns .T. ?????
MSGINFO( oClp:GetMetaFile() ) => returns nil ?????
return nil
Doesn´t work . Is the code correct ?
Gracias Antonio
saludos
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Yuri,
Method IsEmpty() has to be modified this way:
Method IsEmpty() has to be modified this way:
Code: Select all
METHOD IsEmpty() CLASS TClipboard
local uValue
if ::Open()
do case
case ::nFormat == CF_TEXT
return Empty( GetClpData( CF_TEXT ) )
case ::nFormat == CF_BITMAP
return GetClpData( CF_BITMAP ) == 0
case ::nFormat == CF_ENHMETAFILE
return GetClpData( CF_ENHMETAFILE ) == 0
endcase
::Close()
endif
return .T.