Page 1 of 1

Timage problem

Posted: Thu Jan 10, 2008 8:11 pm
by AHF
Hi,

The following code :

oClipboard := TClipboard():New( CF_BITMAP )
hBitmap := oClipboard:GetBitmap()
oClipboard:End()
if hBitmap != 0
cimagemp := unicof(".jpg")
oimg:cResname:=nil
oimg:LoadFromClipboard()
oimg:refresh()

everything ok here

if !oimg:SaveImage(cimagemp,2) //0 = bmp 2 = jpg

it never saves the image to afile.

Any ideas ?

Antonio

Posted: Fri Jan 11, 2008 9:11 am
by AHF
Any ideas ?

Antonio

Re: Timage problem

Posted: Sat Jan 12, 2008 10:30 pm
by Enrico Maria Giordano
This is a working sample:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oImg

    DEFINE DIALOG oDlg;
           SIZE 700, 500

    @ 1, 1 IMAGE oImg;
           FILE "IMAGE.JPG";
           SIZE 200, 200;
           ADJUST

    @ 0,  1 BUTTON "Save";
            ACTION MSGINFO( oImg:SaveImage( "SAVED.JPG", 2 ) )

    @ 0, 7 BUTTON "Paste";
           ACTION ( oImg:LoadFromClipboard(),;
                    oImg:Refresh() )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL
EMG

Posted: Mon Jan 14, 2008 9:16 am
by AHF
Enrico,

Code is basiclly the same.

Doesn't work for me.

If I save a image loaded from clipboard it save the file with o bytes. Otherwise it works ok.

Im using FWH March 2006. What yours ?

Antonio

Posted: Mon Jan 14, 2008 9:45 am
by Enrico Maria Giordano
I'm using the latest FWH (Jan 2008).

EMG