Save Window contents to BMP

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

Save Window contents to BMP

Post by Jeff Barnes »

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

Post by Antonio Linares »

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

Post by Jeff Barnes »

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

Post by Antonio Linares »

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

Post by Jeff Barnes »

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

Post by Jeff Barnes »

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

Post by Antonio Linares »

Jeff,

Very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Andrés González
Posts: 625
Joined: Thu Jan 19, 2006 10:45 am
Location: Mallorca

Post by Andrés González »

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

Post by Jeff Barnes »

Andrés,

Sent to your private email.



Jeff
Post Reply