#ifndef __MEMORY_COMM_HEADER__
#define __MEMORY_COMM_HEADER__

#pragma once

class CMemoryComm
{
public:
	CMemoryComm(void);
	~CMemoryComm(void);

protected:
	HANDLE m_hLock;
	HANDLE m_hFileMap;
	LPVOID m_pMemory;

	CMemoryComm(const CMemoryComm& other);
	CMemoryComm& operator = (const CMemoryComm& other);

public:
	BOOL InitMemery(DWORD dwOffset = 0);
	void Unmap();
	LPVOID GetMemory() const { return m_pMemory; }
	HANDLE GetHandle() const { return m_hFileMap; }
	BOOL Lock(DWORD dwTime);
	void Unlock();
	void Close();
};

#endif