Click here to Skip to main content
11,631,706 members (72,968 online)
Click here to Skip to main content
Add your own
alternative version

Using the Clipboard, Part I : Transferring Simple Text

, 6 May 2002 338.2K 4.1K 160
In this first article of a four-part series on learning everything you ever wanted to know about programming the Windows Clipboard, you'll discover the basic steps of using the Clipboard API to transfer simple (ANSI) text to and from the Clipboard.
// SimpleTextTransfer.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "SimpleTextTransfer.h"
#include "SimpleTextTransferDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CSimpleTextTransferApp

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


// CSimpleTextTransferApp construction

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


// The one and only CSimpleTextTransferApp object

CSimpleTextTransferApp theApp;


// CSimpleTextTransferApp initialization

BOOL CSimpleTextTransferApp::InitInstance()
{
	CWinApp::InitInstance();

	AfxEnableControlContainer();


	CSimpleTextTransferDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

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

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

Share

About the Author

Tom Archer
Software Developer (Senior) Microsoft
United States United States
I'm a Senior Programming Writer in the Microsoft Windows Server organization where my focus is WMI, BITS, WinRM, and SMI-S.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150723.1 | Last Updated 7 May 2002
Article Copyright 2002 by Tom Archer
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid