home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- From: chris@chrism.demon.co.uk (Chris Marriott)
- Path: sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
- Subject: Re: Graphics cut/copy/paste
- Distribution: world
- References: <1993Jan07.200849.9892@eng.umd.edu>
- Organization: None
- Reply-To: chris@chrism.demon.co.uk
- X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
- Lines: 41
- Date: Fri, 8 Jan 1993 19:24:59 +0000
- Message-ID: <726521099snz@chrism.demon.co.uk>
- Sender: usenet@demon.co.uk
-
- In article <1993Jan07.200849.9892@eng.umd.edu> equine@eng.umd.edu writes:
-
- >
- >I am looking for sample code that allows the user to grab a portion of
- >the screen (not window) and copy it to the clipboard or possibly
- >another application. I know that there are commercial software
- >packages that contain this functionality, but we would then need to
- >worry about licensing agreements, etc. when distributing our application.
- >
- >If anyone knows the proper commands/functions to use, has written such
- >a function, or knows of a reference book that contains this
- >information, please let me know.
- >
- >Thanks in advance,
- >Melinda
- >
-
- That's pretty simple. Just:
-
- 1. Get a DC for the screen using "GetDesktopWindow" followed by "GetDC".
- 2. Let the user select the area of the screen by whatever means you
- want.
- 3. Use "CreateCompatibleDC" to create a memory DC compatible with the
- screen DC.
- 4. Use "CreateCompatibleBitmap" to create a bitmap of the correct
- with and height.
- 5. Use "BitBlt" to copy the image from the screen to the bitmap.
- 6. Destroy the memory DC.
- 7. Put the bitmap handle in the clipboard.
-
- Voila!
-
- Chris
- --
- --------------------------------------------------------------------------
- | Chris Marriott | chris@chrism.demon.co.uk |
- | Warrington, UK | BIX: cmarriott |
- | (Still awaiting inspiration | CIX: cmarriott |
- | for a witty .sig .... ) | CompuServe: 100113,1140 |
- --------------------------------------------------------------------------
-
-