Click here to Skip to main content
15,879,068 members
Articles / Desktop Programming / MFC

Screen capture, window resizing utility with source code

Rate me:
Please Sign up or sign in to vote.
4.77/5 (50 votes)
1 Jul 20055 min read 265.7K   8.1K   124  
This utility uses Lim Bio Liong's excellent Spy++ style Window Finder code to build a screen capture utility (featuring text capture as well as bitmaps) and window resizer/mover. It also demonstrates stay on top and expanding/contracting (i.e. more detail / less detail) dialog boxes.
// WinScraper.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "WinScraper.h"
#include "windowfinder.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif



// CWinScraperApp

BEGIN_MESSAGE_MAP(CWinScraperApp, CWinApp)
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()






// CWinScraperApp construction

CWinScraperApp::CWinScraperApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}


// The one and only CWinScraperApp object

CWinScraperApp theApp;


// CWinScraperApp initialization

BOOL CWinScraperApp::InitInstance()
{
	// InitCommonControls() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	InitCommonControls();

	CWinApp::InitInstance();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Data Perceptions"));


	InitialiseResources();
    long lRet = (long)DialogBox
        (
        (HINSTANCE)m_hInstance, // handle to application instance 
        (LPCTSTR)MAKEINTRESOURCE
            (IDD_DIALOG_SEARCH_WINDOW), // identifies dialog box template 
        (HWND)NULL, // handle to owner window 
        (DLGPROC)SearchWindowDialogProc // pointer to dialog box procedure 
        );



	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return lRet;
}

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 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


Written By
CEO Data Perceptions
United Kingdom United Kingdom
Software designer and developer of Prophecy, a multi-user solution for sales forecasting and the Software Update Wizard, an automatic updates component that lets software developers add automatic updates to their Windows applications with a single line of code and which supports automatic updates, even where the logged in user does not have (write) rights to Program Files etc. folders.

I started working life as full time sales forecaster in the CPG sector. Transitioned to IT as I had an interest in software development and felt combining this with my previous business experience would be good.

After many years working for a company I developed Prophecy as a spare-time project and became self-employed in 1998, with Prophecy and the Software Update Wizard as my sole sources of income. It's been an interesting and challenging ride!

Comments and Discussions