FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Copy window to bmp file
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Copy window to bmp file
Posted: Tue Jan 17, 2006 03:16 PM

Hi,

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

Thanks,

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Copy window to bmp file
Posted: Tue Jan 17, 2006 03:29 PM

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

EMG

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Copy window to bmp file
Posted: Tue Jan 17, 2006 05: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

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Copy window to bmp file
Posted: Tue Jan 17, 2006 05:10 PM
This is the method:

SaveToBmp( cBmpFile ) CLASS TWindow

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

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

return ( File( cBmpFile ) )


EMG
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Copy window to bmp file
Posted: Tue Jan 17, 2006 05:24 PM

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

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Copy window to bmp file
Posted: 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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Copy window to bmp file
Posted: Wed Jan 18, 2006 10:33 AM
This is a working sample:

#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
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Copy window to bmp file
Posted: Wed Jan 18, 2006 06: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Copy window to bmp file
Posted: Wed Jan 18, 2006 07:00 PM

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

EMG

Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Copy window to bmp file
Posted: Thu Jan 19, 2006 03:21 AM

Mr.Enrico,

Good alternative suggestion.

Regards,

  • Ramesh Babu P
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Copy window to bmp file
Posted: Sun Jul 29, 2007 05: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Copy window to bmp file
Posted: Sun Jul 29, 2007 07:27 PM

Ramesh,

Its working fine with FWH 7.07

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion