?
Solved

Get a partially covered window's canvas

Posted on 1998-07-25
6
Medium Priority
?
188 Views
Last Modified: 2010-04-04
Get a form's canvas ?

I need to save my form's entire canvas. Now I use the following code:

var AppDC  : HDC;
    Bitmap : TBitmap;
begin
   Bitmap := TBitmap.Create;
   Bitmap.Width := Form1.Width;
   Bitmap.Height := Form1.Height;

   AppDC := GetWindowDC( Form1.Handle );
   BitBlt( Bitmap.Canvas.Handle, 0, 0, Width, Height, AppDC, 0, 0, SRCCOPY );
   ReleaseDC( Form1.Handle, AppDC );

   { ... }

   Bitmap.Free;
end;

This code works well, BUT when another window (such as System monitor)
partially covers my form this window's canvas is also saved to my Bitmap.

How can I save my forms canvas only even if it is partially covered ?

Any help is *greatly* appreciated.

Levente
0
Comment
Question by:Levente
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4

Expert Comment

by:erajoj
ID: 1358676
It's not possible unless you put it on top. The window DC doesn't save any hidden information.
Set FormStyle := fsStayOnTop, take snapshot and reset FormStyle.

/// John
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1358677
Try Forrm.GetFormImage, it returns a bitmap that contains your form.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1358678
Levente, did you try Matvey's suggestion? Form.GetFormImage...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Levente
ID: 1358679
Hi Matvey and Zifnab,

Yes, I've tried it and works perfectly. I think I should 've read the TForm help thoroughly. Sorry.

Levente
0
 
LVL 3

Accepted Solution

by:
Matvey earned 600 total points
ID: 1358680
OK, sorry for not asking permition, but I hope you'll agree that there is no need for this question to stay open anymore...
Glad to help, Matvey
0
 

Author Comment

by:Levente
ID: 1358681
Agreed. I was in a hurry and had no time to read the TForm help thorougly.

Levente
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question