Click here to Skip to main content
13,091,363 members (51,856 online)
Click here to Skip to main content
Articles » Multimedia » GDI » General » Downloads


92 bookmarked
Posted 11 Jan 2003

Barry's Screen Capture

, 11 Jan 2003
An article showing methods of screen capture
// CapITDoc.h : interface of the CCapITDoc class

#if !defined(AFX_CAPITDOC_H__CA8E7EC0_8563_488F_80D7_04DA78F3C8BA__INCLUDED_)
#define AFX_CAPITDOC_H__CA8E7EC0_8563_488F_80D7_04DA78F3C8BA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define PW_WINDOW        1 
#define PW_CLIENT        2 

#define HDIB HANDLE 

#define DIB_HEADER_MARKER   ((WORD) ('M' << 8) | 'B') 

#define WIDTHBYTES(bits)    (((bits) + 31) / 32 * 4) 

#define RECTWIDTH(lpRect)     ((lpRect)->right - (lpRect)->left) 
#define RECTHEIGHT(lpRect)    ((lpRect)->bottom - (lpRect)->top) 

 /* Error constants */ 
 enum {       
 ERR_MIN = 0,                     // All error #s >= this value       
 ERR_NOT_DIB = 0,                 // Tried to load a file, NOT a DIB!       
 ERR_MEMORY,                      // Not enough memory!       
 ERR_READ,                        // Error reading file!       
 ERR_LOCK,                        // Error on a GlobalLock()!       
 ERR_OPEN,                        // Error opening a file!       
 ERR_CREATEPAL,                   // Error creating palette.       
 ERR_GETDC,                       // Couldn't get a DC.       
 ERR_CREATEDDB,                   // Error create a DDB.       
 ERR_STRETCHBLT,                  // StretchBlt() returned failure.       
 ERR_STRETCHDIBITS,               // StretchDIBits() returned failure.       
 ERR_SETDIBITSTODEVICE,           // SetDIBitsToDevice() failed.       
 ERR_STARTDOC,                    // Error calling StartDoc().       
 ERR_NOGDIMODULE,                 // Couldn't find GDI module in memory.       
 ERR_SETABORTPROC,                // Error calling SetAbortProc().       
 ERR_STARTPAGE,                   // Error calling StartPage().       
 ERR_NEWFRAME,                    // Error calling NEWFRAME escape.       
 ERR_ENDPAGE,                     // Error calling EndPage().       
 ERR_ENDDOC,                      // Error calling EndDoc().       
 ERR_SETDIBITS,                   // Error calling SetDIBits().       
 ERR_FILENOTFOUND,                // Error opening file in GetDib()       
 ERR_INVALIDHANDLE,               // Invalid Handle       
 ERR_DIBFUNCTION,                 // Error on call to DIB function       
 ERR_MAX                          // All error #s < this value      

class CCapITDoc : public CDocument
protected: // create from serialization only

// Attributes

// Operations

// Overrides
	// ClassWizard generated virtual function overrides
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);

// Implementation

	virtual ~CCapITDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;


// Generated message map functions
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !


// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CAPITDOC_H__CA8E7EC0_8563_488F_80D7_04DA78F3C8BA__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Barretto VN
India India
Nothing to boast about

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170813.1 | Last Updated 12 Jan 2003
Article Copyright 2003 by Barretto VN
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid