EnumDisplayDevices and Wrapper Classes!

I would like to create an array class to hold multiple wrapper classes containing (MONITORINFOEX, a few more variables including an array of the pixels being displayed). I am noway near this part, I just need the basic class, or classes I need and how they need to be organised.

I have been following many tutorials and become unstuck at EnumDisplayDevices. Previously I used structure to return the information. Would a wrapper class be more suited to the task at hand?


I did find a detailed source code for a similar application here:
http://www.ucancode.net/Visual_C_Source_Code/MFC-Example-Multiple-monitor-support-GetSystemMetrics-EnumDisplayMonitors-GetMonitorInfo%20.htm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#if WINVER < 0x0500
#include "multimon.h"
#endif // WINVER < 0x0500


// CMonitor 

class CMonitor
{
public:
	//construction destruction
	CMonitor();
	CMonitor(const CMonitor& monitor);
	virtual ~CMonitor();

	//operations
	void Attach(const HMONITOR hMonitor);
	HMONITOR Detach();

	void ClipRectToMonitor(LPRECT lpRECT, const BOOL UseWorkAreaRect = FALSE) const;
	void CenterRectToMonitor(LPRECT lpRECT, const BOOL UseWorkAreaRect = FALSE) const;
	void CenterWindowToMonitor(CWnd* const pWnd, const BOOL UseWorkAreaRect = FALSE) const;

	HDC CreateDC() const;

	//properties
	void GetMonitorRect(LPRECT lpRECT) const;
	void GetWorkAreaRect(LPRECT lpRECT) const;

	void GetName(wchar_t& string) const;

	int GetBitsPerPixel() const;

	BOOL IsOnMonitor(const POINT pt) const;
	BOOL IsOnMonitor(const HWND* pHWND) const;
	BOOL IsOnMonitor(const LPRECT lpRECT) 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;

};


An excerpt from Donald Kackman's wrapper class.

Which seems almost exactly what I need but contains some MFC commands (I am just trying to learn basic WinAPI). I need to cut it down to it's basic classes and functions, so I can add and improve. However this is far too complex for me and I am not sure where to begin. Let alone what I need to write to make a practical example I could compile (I even tried using MFC and compiling this program but there were errors and I cannot fix anything)

N.B/ This is not for coursework / university / etc. I am just trying to learn. So I just need advice on *how* I would go about writing this application.
Last edited on
Topic archived. No new replies allowed.