Click here to Skip to main content
15,884,388 members
Articles / Desktop Programming / MFC

Various methods for capturing the screen

Rate me:
Please Sign up or sign in to vote.
4.90/5 (113 votes)
19 Sep 2006LGPL310 min read 1.8M   58.8K   364  
Explains techniques for capturing the screen programmatically.
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_SCREENCAPTURE       ICON                    "ScreenCapture.ico"
IDI_SMALL               ICON                    "small.ico"
IDI_ICON_PAUSE          ICON                    "icon1.ico"
IDI_ICON_START          ICON                    "ico00001.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

IDC_SCREENCAPTURE MENU 
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "Start Capturing to Avi",      ID_FILE_STARTCAPTURINGTOAVI
        MENUITEM "Pause Capturing to Avi",      ID_FILE_PAUSECAPTURINGTOAVI
        MENUITEM SEPARATOR
        MENUITEM "CaptureScreenShot",           ID_FILE_CAPTURESCREENSHOT
        MENUITEM SEPARATOR
        MENUITEM "&Show Window",                ID_FILE_SHOWWINDOW
        MENUITEM "&Hide Window",                133
        MENUITEM SEPARATOR
        MENUITEM "E&xit",                       IDM_EXIT
    END
    POPUP "&Edit"
    BEGIN
        MENUITEM "Save Screen Shot As Bmp",     ID_EDIT_SAVEASBMP
    END
    POPUP "Capture"
    BEGIN
        MENUITEM "&Start",                      ID_CAPTURE_START
        MENUITEM "&Pause",                      ID_CAPTURE_STOP
    END
    POPUP "&Help"
    BEGIN
        MENUITEM "&About ...",                  IDM_ABOUT
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//

IDC_SCREENCAPTURE ACCELERATORS 
BEGIN
    "?",            IDM_ABOUT,              ASCII,  ALT
    "/",            IDM_ABOUT,              ASCII,  ALT
END


/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTBOX DIALOGEX 22, 17, 230, 54
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System", 0, 0, 0x0
BEGIN
    ICON            IDI_SCREENCAPTURE,IDC_MYICON,14,18,16,16
    LTEXT           "ScreenCapture Version 1.0",IDC_STATIC,49,10,119,8,
                    SS_NOPREFIX
    LTEXT           "Copyright (C) 2003",IDC_STATIC,49,22,119,8
    DEFPUSHBUTTON   "OK",IDOK,181,20,30,11,WS_GROUP
    LTEXT           "Captures the Screen using DirectX",IDC_STATIC,50,35,112,
                    8
END


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
    "#include ""windows.h""\r\n"
    "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE 
BEGIN
    IDS_APP_TITLE           "ScreenCapture"
    IDC_SCREENCAPTURE       "SCREENCAPTURE"
END

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

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.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
India India
Creator of CarMusTy - Carnatic Music Typesetting Application, and the CFugue C++ Runtime Environment for MusicNote Programming.

Comments and Discussions