home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4763 < prev    next >
Encoding:
Text File  |  1993-01-08  |  2.0 KB  |  56 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. From: chris@chrism.demon.co.uk (Chris Marriott)
  3. Path: sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
  4. Subject: Re: Graphics cut/copy/paste 
  5. Distribution: world
  6. References: <1993Jan07.200849.9892@eng.umd.edu>
  7. Organization: None
  8. Reply-To: chris@chrism.demon.co.uk
  9. X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
  10. Lines: 41
  11. Date: Fri, 8 Jan 1993 19:24:59 +0000
  12. Message-ID: <726521099snz@chrism.demon.co.uk>
  13. Sender: usenet@demon.co.uk
  14.  
  15. In article <1993Jan07.200849.9892@eng.umd.edu> equine@eng.umd.edu writes:
  16.  
  17. >
  18. >I am looking for sample code that allows the user to grab a portion of
  19. >the screen (not window) and copy it to the clipboard or possibly
  20. >another application.  I know that there are commercial software
  21. >packages that contain this functionality, but we would then need to 
  22. >worry about licensing agreements, etc. when distributing our application. 
  23. >
  24. >If anyone knows the proper commands/functions to use, has written such
  25. >a function, or knows of a reference book that contains this
  26. >information, please let me know.
  27. >
  28. >Thanks in advance,
  29. >Melinda
  30. >
  31.  
  32. That's pretty simple.  Just:
  33.  
  34. 1.  Get a DC for the screen using "GetDesktopWindow" followed by "GetDC".
  35. 2.  Let the user select the area of the screen by whatever means you
  36.     want.
  37. 3.  Use "CreateCompatibleDC" to create a memory DC compatible with the
  38.     screen DC.
  39. 4.  Use "CreateCompatibleBitmap" to create a bitmap of the correct
  40.     with and height.
  41. 5.  Use "BitBlt" to copy the image from the screen to the bitmap.
  42. 6.  Destroy the memory DC.
  43. 7.  Put the bitmap handle in the clipboard.
  44.  
  45. Voila!
  46.  
  47. Chris
  48. -- 
  49. --------------------------------------------------------------------------
  50. | Chris Marriott                           | chris@chrism.demon.co.uk    |
  51. | Warrington, UK                           | BIX: cmarriott              |
  52. | (Still awaiting inspiration              | CIX: cmarriott              |
  53. |  for a witty .sig .... )                 | CompuServe: 100113,1140     |
  54. --------------------------------------------------------------------------
  55.  
  56.