This project is a screen saver application that I originally started as a way to pick up C++/MFC. In the years since, I’ve added some features to it like Outlook Calendar and MAPI support for signaling when new mail arrives while the screen saver is active.
|
#pragma once
//////////////////////////////////////////////////
// CMonitor - wrapper to Win32 multi-monitor API
//
// Author: Donald Kackman
// Email: don@itsEngineering.com
// Copyright 2002, Donald Kackman
//
// You may freely use or modify this code provided this
// Copyright is included in all derived versions.
//
///////////////////////////////////////////////////
//
//David Campbell's article
//How to Exploit Multiple Monitor Support in Memphis and Windows NT 5.0
//is very helpful for multimonitor api calls
//http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0697/monitor/monitor.htm&nav=/msj/0697/newnav.htm
//
//include multimon.h here to get the types
//multimon.cpp includes this with the COMPILESTUBS define to get the implementations
//this is only necessary if the app is supporting win95
#if WINVER < 0x0500
#include "multimon.h"
#endif // WINVER < 0x0500
// CMonitor
class CMonitor : public CObject
{
public:
//construction destruction
CMonitor();
CMonitor( const CMonitor& monitor );
virtual ~CMonitor();
//operations
void Attach( const HMONITOR hMonitor );
HMONITOR Detach();
void ClipRectToMonitor( LPRECT lprc, const BOOL UseWorkAreaRect = FALSE ) const;
void CenterRectToMonitor( LPRECT lprc, const BOOL UseWorkAreaRect = FALSE ) const;
void CenterWindowToMonitor( CWnd* const pWnd, const BOOL UseWorkAreaRect = FALSE ) const;
HDC CreateDC() const;
//properties
void GetMonitorRect( LPRECT lprc ) const;
void GetWorkAreaRect( LPRECT lprc ) const;
void GetName( CString& string ) const;
int GetBitsPerPixel() const;
BOOL IsOnMonitor( const POINT pt ) const;
BOOL IsOnMonitor( const CWnd* pWnd ) const;
BOOL IsOnMonitor( const LPRECT lprc ) const;
BOOL IsPrimaryMonitor() const;
BOOL IsMonitor() const;
//operators
operator HMONITOR() const
{
return this == NULL ? NULL : m_hMonitor;
}
BOOL operator ==( const CMonitor& monitor ) const
{
return m_hMonitor == (HMONITOR)monitor;
}
BOOL operator !=( const CMonitor& monitor ) const
{
return !( *this == monitor );
}
void operator =( const CMonitor& monitor )
{
m_hMonitor = (HMONITOR)monitor;
}
private:
HMONITOR m_hMonitor;
};
|
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.
The first computer program I ever wrote was in BASIC on a TRS-80 Model I and it looked something like:
10 PRINT "Don is cool"
20 GOTO 10
It only went downhill from there.
Hey look, I've got a blog