Click here to Skip to main content
15,880,405 members
Articles / Programming Languages / C++

Debug With Apps Displayed on Secondary Monitor

Rate me:
Please Sign up or sign in to vote.
4.54/5 (20 votes)
29 Nov 20062 min read 58K   731   29  
Here's some code that will automatically start your app on a secondary monitor if it's compiled with debug info.
// SecondaryDebugView.cpp : implementation of the CSecondaryDebugView class
//

#include "stdafx.h"
#include "SecondaryDebug.h"

#include "SecondaryDebugDoc.h"
#include "SecondaryDebugView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CSecondaryDebugView

IMPLEMENT_DYNCREATE(CSecondaryDebugView, CView)

BEGIN_MESSAGE_MAP(CSecondaryDebugView, CView)
END_MESSAGE_MAP()

// CSecondaryDebugView construction/destruction

CSecondaryDebugView::CSecondaryDebugView()
{
	// TODO: add construction code here

}

CSecondaryDebugView::~CSecondaryDebugView()
{
}

BOOL CSecondaryDebugView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

// CSecondaryDebugView drawing

void CSecondaryDebugView::OnDraw(CDC* /*pDC*/)
{
	CSecondaryDebugDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: add draw code for native data here
}


// CSecondaryDebugView diagnostics

#ifdef _DEBUG
void CSecondaryDebugView::AssertValid() const
{
	CView::AssertValid();
}

void CSecondaryDebugView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CSecondaryDebugDoc* CSecondaryDebugView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSecondaryDebugDoc)));
	return (CSecondaryDebugDoc*)m_pDocument;
}
#endif //_DEBUG


// CSecondaryDebugView message handlers

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
Software Developer (Senior) Paddedwall Software
United States United States
I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.

My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.

Comments and Discussions