Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy image to clipboard GDIPlus-X

Status
Not open for further replies.

cibe86

Programmer
Sep 12, 2013
12
0
0
IT
Hi everybody!
I have a code that copy an image on my form to clipboard using gdiplus.
I make something like this
Code:
#Define CF_BITMAP       2

Declare Long LoadImage in User32; 
    Long hInst, String cFilename, Integer nType, ; 
    Integer cxDesired, Integer cyDesired, Integer fuLoad

loImage = _SCREEN.System.Drawing.Bitmap.fromvarbinary(this.image.PictureVal)

loImage.Save("c:\img.bmp", _SCREEN.System.Drawing.Imaging.ImageFormat.Bmp)

hBitmap = LoadImage(0, "c:\img.bmp", 0, 0,0, 0x10)

IF (OpenClipboard(0) <> 0)

	EmptyClipboard()
	SetClipboardData(CF_BITMAP,hBitmap)
	closeclipboard()	
ENDIF

As you can see I pass through the LoadImage function to get a working handle of the image since I tried loImage.handle, loImage.gethandle(), loImage.streamprt without any result, SetClipboardData is working only with hBitmap.
Is there a way to avoid using LoadImage and getting a working handle from loImage?
Maybe is easy but unfortunatly I'm not expert in clipboard and gdiplus.
Thank you!
 
Thank you mgagnon but unfortunatly I can't access ...

 
[pre]Lparameters pcSourcefile
Do Case
Case Type('pcSourceFile')#'C'
Case !Empty(Justext(pcSourceFile))
Case Adir(temp,pcSourceFile)=0
Otherwise
Return -1
Endcase
Local loGfx as AS xfcBitmap
If !Type('_screen.system')='O'
Do prog\gdiplusx\app\system.app
Endif
loGFX=_screen.system.Drawing.Bitmap.New(pcSourcefile)
loGFX.ToClipboard()
Return !loGFX.Size.isempty[/pre]
 
Okay, so there is a link and snippet of code above, but neither contain comments, commentary, explanation, description, usage, logic train, why, whatfor, whether, ..., nothing.
That's what I thought this forum was about.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top