#pragma once
class __declspec(dllexport) CSingle
{
private:
CSingle();
public:
~CSingle()
{
delete m_pWin;
}
static CSingle& instance()
{
static CSingle ins;
return ins;
}
HWND GetWnd();
void CloseWindow();
private:
class CMWindow* m_pWin;
};
#include "StdAfx.h"
#include "MWindow.h"
#include "afxwin.h"
class CMWindow : public CWnd
{
public:
CMWindow(void){}
~CMWindow(void){}
public:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_DESTROY)
{
int rew = 0;
//return 0; //即使返回,m_hWnd也是0
}
if(message == WM_CLOSE)//经过这里之后会再经过WM_DESTROY
{
int haohao = 0;
//return 0; 返回就是没有关闭;如果关闭,m_hWnd将是0
}
return CWnd::WindowProc(message, wParam, lParam);
}
virtual BOOL DestroyWindow() //这里直接发送WM_DESTROY,不经过WM_CLOSE
{
return CWnd::DestroyWindow();
}
};
CSingle::CSingle()
{
/*CS_VREDRA