How to save a dialog/window to Bitmap ?

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

How to save a dialog/window to Bitmap ?

Post by RAMESHBABU »

Hello Mr.Antonio

The following function is not saving the window to bitmap.

Code: Select all

#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


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

Post by Antonio Linares »

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

Post by RAMESHBABU »

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
Post Reply