Solved

Form Image including TitleBar

Posted on 2003-11-12
11
327 Views
Last Modified: 2013-11-18
Hi Friends

I want to take the image of an invisible Form.

I have tried it using GetFormImage and PaintTo
But this all gives only the image of the client area. But i want to get the image including title bar Like we use Alt + PrintScreen

Thanks


Cheers
0
Comment
Question by:Bijith
[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
  • 4
  • 3
  • 2
11 Comments
 
LVL 4

Expert Comment

by:kabix
ID: 9735566
you want to make a screen shot of a program or what? Please explain more...
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 50 total points
ID: 9736996
If it is invisible, you can't get an image of it.
0
 
LVL 3

Author Comment

by:Bijith
ID: 9737469
Thanks for your comments

kabix,

Yes, I want to get the image of the form. similar to screenshort.


 EddieShipman,

Using GetFormImage,  PaintTo you can take the image of the form. But  it have only the image of clientarea(Excluding titlebar and border).

But I want the image of complete form

thanks


0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 26

Expert Comment

by:EddieShipman
ID: 9738938
Like I said...
"If it is invisible, you can't get an image of it."
0
 
LVL 3

Author Comment

by:Bijith
ID: 9739368
EddieShipman,

Using  GetFormImage,  PaintTo  you can take the image of windows client area

thanks
0
 
LVL 4

Expert Comment

by:kabix
ID: 9740279
Is the form invisible or you can see it? Because if the form is invisible you can not take a screen shot of it like you do with printscreen
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 9741089
Here is your solution even thought it won't work on an INVISIBLE window.
Like I said before, YOU CAN NOT GET AN IMAGE OF AN INVISIBLE FORM.


  function GetWindowBitmap(hWindow:hWnd):HBitmap;
  var
    DC,MemDC:HDC;
    bmWidth,bmHeight:Integer;
    TR:tRect;
    bm,obm:HBitmap;
  begin
    // full window bitmap
    GetWindowRect(hWindow,TR);
    { note the +1 }
    bmWidth:=TR.Right-TR.Left+1;
    bmHeight:=TR.Bottom-TR.Top+1;
    // Full Screen DC
    DC:=GetDC(0);
    MemDC:=CreateCompatibleDC(DC);

    bm:=CreateCompatibleBitmap(DC,bmWidth,bmHeight);
    // now select the bitmap to memDC
    obm:=SelectObject(MemDC,bm);
    // and copy the window

    BitBlt(MemDC,0,0,bmWidth,bmHeight,DC,tr.left,tr.top,SRCCOPY);
    // clean up
    SelectObject(MemDC,obm);
    DeleteDC(MemDC);
    ReleaseDC(hWindow,DC);
    // here is your bitmap
    GetWindowBitmap:=bm;
  end;
0
 
LVL 3

Author Comment

by:Bijith
ID: 9745548
Screen is invisible

EddieShipman,

Thanks for your code. But this is not what i required, This was what my program was doing previously. But now i want to take the image in another way.

Also You are still holding on the point that "YOU CAN NOT GET AN IMAGE OF AN INVISIBLE FORM."

But now i am getting the image of the client area of the invisible form.
I am using PaintTo method. I will supply a deveice context to it . So it will contain the image of the client area and the controls inside client area.


regards
Bijith
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 12754198
But as you said, you use PaintTo and it does only clientarea of the form.
You are going to have to live with that or make your form visible to get caption.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to dynamically set the form action using jQuery.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

623 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