Click here to Skip to main content
15,896,269 members
Articles / Desktop Programming / MFC

MemSpyy

Rate me:
Please Sign up or sign in to vote.
4.95/5 (9 votes)
29 Oct 2007CPOL2 min read 34.7K   793   33  
Using OpenGL to map the virtual memory address space.
#pragma once


// COpenGLControl
#include "OpenGLDevice.h"
#include <GL\gl.h>
#include <GL\glu.h>
#include <map>

class COpenGLControl : public CWnd
{
	DECLARE_DYNAMIC(COpenGLControl)

public:
	COpenGLControl();
	virtual ~COpenGLControl();

protected:
	DECLARE_MESSAGE_MAP()

protected:
	void InitGL();
	void DrawGLScene( bool inSelect = false );
	OpenGLDevice openGLDevice;
	CClientDC* dc;
public:
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnPaint();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);

	BOOL RegisterWindowClass();
	void SetPID( unsigned long inPID ) { m_PID = inPID; DrawGLScene();}
	void ForceDraw();

private:
	void DrawMemory( SIZE_T blockSizeBytes );
	void CheckInit();


	GLfloat m_CurrentStartX;
	GLfloat m_CurrentStartY;

	int m_Width;
	int m_Height;

	int m_OriginX;
	int m_OriginY;

	int m_PrevY;
	int m_PrevX;
	int m_PrevLDownY;
	int m_PrevLDownX;
	int m_PrevRDownY;
	int m_PrevRDownX;

	GLfloat m_Red;
	GLfloat m_Blue;

	int m_DefaultWidth;
	int m_DefaultHeight;

	bool m_OpenGLInitialized;

	unsigned long m_CurrentlySelected;

	unsigned long m_PID;

	std::map<unsigned long, PVOID> m_MemoryBlocks;

public:
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
};


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
Web Developer
United States United States
PJ currently works for Avid Technology, and lives in Cambridge, MA. When he isn't coding, you can find him collecting old dusty funk & soul records.

Comments and Discussions