MetaFile to ClipBoard

MetaFile to ClipBoard

Postby yury » Thu Aug 30, 2007 11:17 am

hi everyone,

Is possible copy the content of metafile to clipboard of Windows ?

regards
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Postby Antonio Linares » Fri Aug 31, 2007 12:11 am

Yuri,

Yes, the Windows clipboard supports metafiles by default. Please add this method to FWH Class TClipboard:
Code: Select all  Expand view  RUN
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby yury » Fri Aug 31, 2007 2:30 pm

Hi Antonio,

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  Expand view  RUN
method GetMetaFile()

   local hMetaFile := 0

   if ::Open()
      hMetaFile = GetClpData( CF_ENHMETAFILE )
      ::Close()
   endif

return hMetaFile



For test it, I changed my RPreview function this way:


Code: Select all  Expand view  RUN
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
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Postby Antonio Linares » Fri Aug 31, 2007 4:26 pm

Yuri,

Method IsEmpty() has to be modified this way:
Code: Select all  Expand view  RUN
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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby yury » Sat Sep 01, 2007 3:52 pm

hi Antonio,

Now the method IsEmpty() is ok !

thank you !

saludos
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 93 guests