Save Window contents to BMP

Save Window contents to BMP

Postby Jeff Barnes » Sat Mar 31, 2007 1: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
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Antonio Linares » Sat Mar 31, 2007 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Jeff Barnes » Sat Mar 31, 2007 8: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)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Antonio Linares » Sat Mar 31, 2007 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

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

Postby Antonio Linares » Sun Apr 01, 2007 5:46 am

Jeff,

Very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Andrés González » Fri Apr 06, 2007 8: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
User avatar
Andrés González
 
Posts: 628
Joined: Thu Jan 19, 2006 10:45 am
Location: Mallorca

Postby Jeff Barnes » Fri Apr 06, 2007 10:13 pm

Andrés,

Sent to your private email.



Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 81 guests