Click here to Skip to main content
15,892,253 members
Articles / Desktop Programming / MFC

Transparent Console Application

Rate me:
Please Sign up or sign in to vote.
4.18/5 (9 votes)
30 Aug 2004CPOL2 min read 61.4K   2.1K   23  
Implementing a transparent console application.
// TConsoleView.h : interface of the CTConsoleView class
//


#pragma once
#include "c:\program files\microsoft visual studio .net 2003\vc7\atlmfc\include\afxwin.h"
#include "editredir.h"
#include "hmxedit.h"
#include "hmxcombobox.h"
#include "eventer.h"
#include "fonthelper.h"

class CTConsoleView : public CFormView, Eventer
{
protected: // create from serialization only
	CTConsoleView();
	DECLARE_DYNCREATE(CTConsoleView)

public:
	enum{ IDD = IDD_TCONSOLE_FORM };

// Attributes
public:
	CTConsoleDoc* GetDocument() const;

// Operations
public:
	void SetBackgroundColor(COLORREF crBackground);
// Overrides
	public:
		virtual void PerformAction(const CString& strCmd);
		virtual void PerformSpecialAction(UINT nAction);

virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct

// Implementation
public:
	virtual ~CTConsoleView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	CEditRedirector m_redir;
	int m_comboHeight;
	static const int c_comboShift = 20;
	CFontHelper cslFntHelper;
	CFontHelper cmdFntHelper;

	COLORREF m_crBackground;
	CBrush m_wndbkBrush;	// background brush

	void SaveColors();
	void LoadColors();
// Generated message map functions
protected:
	
	DECLARE_MESSAGE_MAP()	

public:
	CHMXEdit m_edit;
	CHMXComboBox m_combo;
public:
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnNewconsole();
	afx_msg void OnViewColors();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
};

#ifndef _DEBUG  // debug version in TConsoleView.cpp
inline CTConsoleDoc* CTConsoleView::GetDocument() const
   { return reinterpret_cast<CTConsoleDoc*>(m_pDocument); }
#endif

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 Code Project Open License (CPOL)


Written By
Software Developer
Israel Israel
Software designer and programmer.
Programming languages:
MFC, C++, Java , C#, VB and sometimes C and assembly.

Comments and Discussions