Screen Capture Interface

Posted on 2004-11-17
Last Modified: 2010-05-18
I would like to build a screen capture interface that will allow the user to select an area of the screen.  I already have the code I need to get the selected area as a bitmap.  I am only asking about how to do an interface for selecting an area of the screen.

My first attempt was to create an always on top form, that had the middle portion transparent.  The user could move the form, and resize it.  The transparent portions of the form showed the part that was to be captured.  This worked, until I minimized the other forms in my program.  This form was also minimized.

I would like the capture interface to be available, even if the main form of the application is minimized.  I would also like to capture interface to appear on top of anything else that may be on the screen.

I would like the interface to be "live", so that the user can capture things on the screen, as they are changing.  capturing a static image of the whole screen, and then selecting a portion of that, is not a viable solution.

I have seen other capture programs that allow you to use the mouse to draw a box on the screen, on top of all windows, by selecting two corners.  Any ideas how this is done? or, do you have any other ideas that may work?
Question by:wolsen
    LVL 12

    Expert Comment

    >> "This form was also minimized"
    Take a look at my answer here

    Otherwise, you can use CopyRect method of the Canvas to copy spcific area of the desktop.
    LVL 33

    Accepted Solution

    hello  wolsen, , If you want a "Real Time" desktop display and smaller screen Rectangle capture, then I would use a DLL mouse hook and have the user draw his screen rectangle with his mouse, but this is not a delphi form sort of thing and may not be simple, , you can see some code for this at this EE question -

    ask questions if you need more information
    LVL 1

    Expert Comment


    procedure GetScreen(var bmp: TBitmap);
       dc : integer;
       c  : TCanvas;
       R  : TRect;
       bmp := TBitmap.Create;

       dc := GetWindowDC(Form1.Handle);
          c := TCanvas.Create;
          c.Handle := dc;
          R := Rect(0, 0, Screen.Width, Screen.Height);
          bmp.Width := R.Right;
          bmp.Height := R.Bottom;
          bmp.Canvas.CopyRect(R, c, R);
          c.Handle := 0;
          ReleaseDC(Form1.Handle, dc);


    In BMP variable you have image of form1!

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    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…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    729 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