mousewheelmgr.cpp

来自「管理项目进度工具的原代码」· C++ 代码 · 共 67 行

CPP
67
字号
// MouseWheelMgr.cpp: implementation of the CMouseWheelMgr class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MouseWheelMgr.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMouseWheelMgr::CMouseWheelMgr()
{

}

CMouseWheelMgr::~CMouseWheelMgr()
{

}

BOOL CMouseWheelMgr::Initialize()
{
	return GetInstance().InitHooks(HM_MOUSE);
}

BOOL CMouseWheelMgr::OnMouse(UINT uMouseMsg, const MOUSEHOOKSTRUCTEX& info)
{
   if (uMouseMsg == WM_MOUSEWHEEL)
   {
	   //fabio_2005
#if _MSC_VER >= 1300

      HWND hwndPt = ::WindowFromPoint(info.pt);

      if (info.hwnd != hwndPt)  // does the window under the mouse have the focus.
      {
		  ::PostMessage(hwndPt, WM_MOUSEWHEEL, (info.mouseData & 0xffff0000), 
						MAKELPARAM(info.pt.x, info.pt.y));

		  return TRUE; // eat
      }
   }
#else

      HWND hwndPt = ::WindowFromPoint(info.MOUSEHOOKSTRUCT.pt);

      if (info.MOUSEHOOKSTRUCT.hwnd != hwndPt)  // does the window under the mouse have the focus.
      {
		  ::PostMessage(hwndPt, WM_MOUSEWHEEL, (info.mouseData & 0xffff0000), 
						MAKELPARAM(info.MOUSEHOOKSTRUCT.pt.x, info.MOUSEHOOKSTRUCT.pt.y));

		  return TRUE; // eat
      }
   }

#endif
   // all else
   return FALSE;
}

⌨️ 快捷键说明

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