util_pop.cpp

来自「一个功能强大的串行口监视和检测程序的源代码。」· C++ 代码 · 共 81 行

CPP
81
字号

// util_pop.cpp

#include "stdafx.h"
#include "util_pop.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif



GPopupWindow::GPopupWindow()
{
}


GPopupWindow::~GPopupWindow()
{

}


void GPopupWindow::PostNcDestroy()
{
   delete this;
}


BOOL GPopupWindow::OnLButtonDownCheck(UINT nFlags, CPoint pt)
{
   CRect cr;
   GetClientRect(cr);

   if(!cr.PtInRect(pt))
      return TRUE;

   return FALSE;
}


BEGIN_MESSAGE_MAP(GPopupWindow, CWnd)
   ON_WM_CREATE()
   ON_WM_DESTROY()
   ON_WM_CAPTURECHANGED()
   ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()



void GPopupWindow::OnCaptureChanged(CWnd *pWnd)
{
   PostMessage(WM_CLOSE);
}


int GPopupWindow::OnCreate(LPCREATESTRUCT lpcs)
{
   int nCreate = CWnd::OnCreate(lpcs);
   
   SetCapture();
   return nCreate;
}




void GPopupWindow::OnLButtonDown(UINT nFlags, CPoint pt)
{
   if(OnLButtonDownCheck(nFlags, pt))
   {
      ::ReleaseCapture();
   }
}



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?