Solved

geting the formshot

Posted on 2007-03-21
10
187 Views
Last Modified: 2013-11-22
Hello,

Is it possible to take a window (form) screenshot in windows xp by reading it's canvas property and will that work if the window is mimimized or covered by another window? I know that you can draw on a form's canvas, read the content and store it as a bitmap and also by reading the canvas of the entire desktop you can get a screenshot, but can you get a formshot?

Thank you, Hrvoje
0
Comment
Question by:hdagelic
  • 5
  • 3
  • 2
10 Comments
 
LVL 15

Expert Comment

by:riteheer
ID: 18763438
Nope,
If the windows is minimized, you won't get the formshot/screenshot from properties.
Sorry
0
 
LVL 21

Expert Comment

by:ziolko
ID: 18763544
you can use BitBlt() function if you have handle of source canvas,
but when form is not shown or minimized you will not be able to take its snapshot
canvas contents are not stored all the time form is painted when becomes visible thru Paint method
(defined in TCustomControl) when control recives WM_PAINT message

ziolko.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 18763556
sorry riteheer i didn't refresh my webbrowser

ziolko.
0
 
LVL 15

Expert Comment

by:riteheer
ID: 18763613
ziolko,
Is np, happens all the time, and just reaffirms the asker is getting good advice and plenty of attetion... <smile>
Good day,
Jappo
0
 
LVL 21

Expert Comment

by:ziolko
ID: 18763651
heh:) i just hope he's here for advice not attention :)

ziolko.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:hdagelic
ID: 18763655
Ok, thanks,  that could be solved by intercepting WM_MINIMIZE or something like that and taking the formshot just before. But do you know if it would work if the window is under another window? I know that when you drag another window over a form it clears that area of a form, but it gets repainted... I also find it strange that googleing for formshots returns nothing special.
0
 
LVL 21

Accepted Solution

by:
ziolko earned 125 total points
ID: 18763707
i did this:
BitBlt(Self.Canvas.Handle, 0, 0, Form2.ClientWidth, Form2.ClientHeight, Form2.Canvas.Handle, 0, 0, SRCCOPY);

with form2 partly covered and result was same as on screen so also covered.

window repaints only that region which is visible, so i'm afraid answer is no again

ziolko.
0
 

Author Comment

by:hdagelic
ID: 18763748
You also couldn't get the shots with MDI child forms when reading the parent's canvas. True?
0
 
LVL 21

Expert Comment

by:ziolko
ID: 18763813
i didn't  try it with MDI but basically you can make snapshot of what you can see on monitor.

ziolko.
0
 

Author Comment

by:hdagelic
ID: 18765182
Shure, that's all I need, thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now