 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
D.Theis Guest
|
Posted: Wed Mar 16, 2005 5:05 pm Post subject: stretchblt to canvas with desktop as src doesn't free on rep |
|
|
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
|
Posted: Wed Mar 16, 2005 7:00 pm Post subject: Re: stretchblt to canvas with desktop as src doesn't free on |
|
|
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
|
Posted: Wed Mar 16, 2005 10:17 pm Post subject: Re: stretchblt to canvas with desktop as src doesn't free on |
|
|
I see your point. It is acting as it should. Thanks.
"Peter Below (TeamB)" <100113.1101 (AT) compuXXserve (DOT) com> wrote
|
|
| Back to top |
|
 |
|
|
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
|
|