How to save a dialog/window to Bitmap ?

How to save a dialog/window to Bitmap ?

Postby RAMESHBABU » Sun Jul 29, 2007 4:47 pm

Hello Mr.Antonio

The following function is not saving the window to bitmap.

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

function Main()

   DEFINE WINDOW oWnd TITLE "SaveToBmp"

   @ 9, 2 BUTTON "Save To Bmp" ;
      SIZE 210, 30 ;
      ACTION ( oWnd:SaveToBmp( CurDir() + "\test.bmp" ), MsgInfo( "done!" ) )
     
   ACTIVATE WINDOW oWnd
   
return nil     


I tried with the following code also. But could not get the result.

Code: Select all  Expand view

FUNCTION Save2Bmp( cFile, oDlg )

   DEFAULT cFile := "Saved.Bmp"

   DibWrite( cFile, DibFromBitmap( WndBitmap( oDlg:hWnd ) ) )

RETURN ( FILE( cFile ) )



Please guide me how to save a dialog/window to bitmap file.

Regards

- 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:24 pm

Call it this way:

... ACTION ( oWnd:SaveToBmp( "test.bmp" ), MsgInfo( "done!" ) )

Here its working fine:
Image
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

Postby RAMESHBABU » Mon Jul 30, 2007 1:31 am

Sorry! Mr.Antonio,

It is generating a small file of 14 bytes.

I tried with oWnd:SaveToBmp(cBmpFile) and
DibWrite( cBmpFile, DibFromBitmap( WndBitmap( oDlg:hWnd ) ) ).

But, same out come.

For your information, it is tested in WIN98 and found not working.

Please test with 2.8 (Septermber) release.

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests