BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

stretchblt to canvas with desktop as src doesn't free on rep

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
D.Theis
Guest





PostPosted: Wed Mar 16, 2005 5:05 pm    Post subject: stretchblt to canvas with desktop as src doesn't free on rep Reply with quote



I have some odd behavior in this event. The canvas is getting redrawn with
in itself and I cannot see why. I just want to repaint the desktop to the
canvas each time. (as it does on the first time)
-damon

var
MyX,OrigX : TXForm;
DrawDC : HDC;
OldGM, dx, dy : Integer;
MyCanvas:TCanvas;
begin

MyCanvas:=TCanvas.Create;
MyCanvas.Handle := GetWindowDC(GetDesktopWindow());
dx := getsystemmetrics(SM_CXSCREEN);
dy := getsystemmetrics(SM_CYSCREEN);
// Width and height of the desktop area

//modify
DrawDC := GetDC(panel1.Handle);
OldGM := SetGraphicsMode(DrawDC, GM_ADVANCED);
if GetWorldTransform(DrawDC,OrigX) = false then showmessage('get world
failed');
MyX.eM11:=-1;
MyX.eM22:=1;
MyX.eM12:=0;
MyX.eM21:=0;
MyX.eDx := panel1.width;
MyX.eDy := panel1.height;

if ModifyWorldTransform(DrawDC,MyX,MWT_LEFTMULTIPLY) = false then
showmessage('modify world failed');

stretchblt(DrawDC,0,0,panel1.Width,panel1.height*-1,
mycanvas.handle,0,0,dx,dy,
SRCCOPY);

SetWorldTransform(DrawDC,OrigX);
SetGraphicsMode(DrawDC, OldGM);
ReleaseDC(Panel1.Handle, DrawDC);
mycanvas.free;
mycanvas := nil;

end;


Back to top
Peter Below (TeamB)
Guest





PostPosted: Wed Mar 16, 2005 7:00 pm    Post subject: Re: stretchblt to canvas with desktop as src doesn't free on Reply with quote



In article <423867be$1 (AT) newsgroups (DOT) borland.com>, D.Theis wrote:
Quote:
I have some odd behavior in this event. The canvas is getting redrawn with
in itself and I cannot see why. I just want to repaint the desktop to the
canvas each time. (as it does on the first time)
-damon

var
MyX,OrigX : TXForm;
DrawDC : HDC;
OldGM, dx, dy : Integer;
MyCanvas:TCanvas;
begin

MyCanvas:=TCanvas.Create;
MyCanvas.Handle := GetWindowDC(GetDesktopWindow());

This gives you a DC for the whole screen, same as GetDC(0). What Windows calls
the desktop window is not what you think it is (the Explorer desktop window).

And you need to release this DC before you destroy MyCanvas, TCanvas.Destroy
does *not* do that for you.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
D.Theis
Guest





PostPosted: Wed Mar 16, 2005 10:17 pm    Post subject: Re: stretchblt to canvas with desktop as src doesn't free on Reply with quote



I see your point. It is acting as it should. Thanks.

"Peter Below (TeamB)" <100113.1101 (AT) compuXXserve (DOT) com> wrote

Quote:
In article <423867be$1 (AT) newsgroups (DOT) borland.com>, D.Theis wrote:
This gives you a DC for the whole screen, same as GetDC(0). What Windows
calls
the desktop window is not what you think it is (the Explorer desktop
window).

And you need to release this DC before you destroy MyCanvas,
TCanvas.Destroy
does *not* do that for you.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.