Solved

Form Image including TitleBar

Posted on 2003-11-12
11
323 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
  • 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
 
LVL 26

Expert Comment

by:EddieShipman
ID: 9738938
Like I said...
"If it is invisible, you can't get an image of it."
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error E2158 compiling with Delphi XE10 Seattle 2 88
Delphi inherited method 6 63
Questions about this React unit test 4 45
Randomize in Owl Carousel v1.3.2 6 20
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

920 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

15 Experts available now in Live!

Get 1:1 Help Now