Copy window to bmp file

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Copy window to bmp file

Post by Jeff Barnes »

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: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

This is the method:

Code: Select all

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
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

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

Jeff
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post by RAMESHBABU »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

This is a working sample:

Code: Select all

#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
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post by RAMESHBABU »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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

EMG
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post by RAMESHBABU »

Mr.Enrico,

Good alternative suggestion.

Regards,

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

Post by RAMESHBABU »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Ramesh,

Its working fine with FWH 7.07
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply