Copy window to bmp file

Copy window to bmp file

Postby Jeff Barnes » Tue Jan 17, 2006 3:16 pm

Hi,

Is there any way to copy a window (or part of a window) to a bmp file?


Thanks,

Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Copy window to bmp file

Postby Enrico Maria Giordano » Tue Jan 17, 2006 3:29 pm

For the entire window you can use TWindow:SaveToBmp() method.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jeff Barnes » Tue Jan 17, 2006 5:06 pm

Thanks for the fast reply Enrico but it does not seem to work.

I get a run time error: Message not found: TWINDOW:SAVETOBMP



Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Enrico Maria Giordano » Tue Jan 17, 2006 5:10 pm

This is the method:

Code: Select all  Expand view
SaveToBmp( cBmpFile ) CLASS TWindow

   local hBmp := WndBitmap( ::hWnd )
   local hDib := DibFromBitmap( hBmp )

   DibWrite( cBmpFile, hDib )
   GloBalFree( hDib )
   DeleteObject( hBmp )

return ( File( cBmpFile ) )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jeff Barnes » Tue Jan 17, 2006 5:24 pm

Thanks, I've got it working now :-))

Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby RAMESHBABU » Wed Jan 18, 2006 10:07 am

Mr.EMG

Similar to the above, is there any method to save a dialog to BMP ?

Note : Tried to save a dialog using your above solution. But could not save it.

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Enrico Maria Giordano » Wed Jan 18, 2006 10:33 am

This is a working sample:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    @ 0,  1 BUTTON "Save BMP" ACTION oDlg:SaveToBmp( "SAVED.BMP" )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby RAMESHBABU » Wed Jan 18, 2006 6:50 pm

Mr.Enrico

Thank you very much for your quick answer.

I tried the funciton SaveToBmp("SavedBmp") in association with INIT clause. It did not work. But it is working coolly with ON PAINT clause to save a Dialog to BMP.

Thank you very much for your attendtion.

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Enrico Maria Giordano » Wed Jan 18, 2006 7:00 pm

Try with oDlg:bStart codeblock instead of ON INIT clause. During ON INIT (initialization) the dialog is not painted yet.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby RAMESHBABU » Thu Jan 19, 2006 3:21 am

Mr.Enrico,

Good alternative suggestion.

Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby RAMESHBABU » Sun Jul 29, 2007 5:11 pm

Hi all

oDlg:SaveToBmp( "SAVED.BMP" ) was working earlier. Now it is not
working !.

Has any body succeeded with oDlg:SaveToBmp( "SAVED.BMP" ) ?

I am using FWH 2.8 (September 2006) Version + xHarbour 0.99.71 (Simplex)

Thanks

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Antonio Linares » Sun Jul 29, 2007 7:27 pm

Ramesh,

Its working fine with FWH 7.07
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 28 guests