FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Save Window contents to BMP
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Save Window contents to BMP
Posted: Sat Mar 31, 2007 01:28 AM

Hi Everybody,

I need to save the contents of a window to a bmp file.

I tried oWnd:SaveToBmp( cFile ) but it also copies the boarder.

Is there any function to copy only what is inside the window?

Thanks,
Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Save Window contents to BMP
Posted: Sat Mar 31, 2007 09:03 AM

Jeff,

Class TWindow Method SaveToBmp() calls the function WndBitmap().

If you modify WndBitmap() to call GetDC() instead of GetWindowDC(), then it will just save the window contents, without the caption and borders.

We could modify Method SaveToBmp() adding a new parameter:

Method SaveToBmp( cBmpFile, lBorder ) where lBorder may be .T. by default

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Save Window contents to BMP
Posted: Sat Mar 31, 2007 08:50 PM

Thanks Antonio.

What is the correct procedure to recompile the WndPrint.c file so I can link it into my app?

Thanks,
Jeff

(xHarb, FWH, Borland complier)

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Save Window contents to BMP
Posted: Sat Mar 31, 2007 09:03 PM

Jeff,

First call tools\clp2harb.exe module.c modified.c

then

bcc32 -c -Ic:\harbour\include;c:\fwh\include -D__HARBOUR__ -D__FLAT__ modified.c

that will provide you a modified.obj

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Save Window contents to BMP
Posted: Sun Apr 01, 2007 12:25 AM

Ok, I'm almost there.

I have modified the wndprint.c file and most of the window border is gone.

There is still the Bottom and Right part of the window being copied.

Is there something I can change to remove these?

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Save Window contents to BMP
Posted: Sun Apr 01, 2007 12:39 AM

OK ... I've got it.

I manipulated the value for rct.right and rct.bottom (basically subtracted until I found the perfect number)

All borders are now gone.

Thanks for your help,

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Save Window contents to BMP
Posted: Sun Apr 01, 2007 05:46 AM

Jeff,

Very good :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 632
Joined: Thu Jan 19, 2006 10:45 AM
Save Window contents to BMP
Posted: Fri Apr 06, 2007 08:25 AM

Jeff,
I'm interested in the changes you have done. Please could you send to me. To my email: zalezalon@gmail.com.

This is my related message:

http://fivetechsoft.com/forums/viewtopi ... t=pantalla

Thanks

Saludos



Andrés González desde Mallorca
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Save Window contents to BMP
Posted: Fri Apr 06, 2007 10:13 PM

Andrés,

Sent to your private email.

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion