getdisplayworkarea.cpp

来自「hl2 source code. Do not use it illegal.」· C++ 代码 · 共 41 行

CPP
41
字号
/*----------------------------------------------------------------------
Copyright (c) 1998,1999 Gipsysoft. All Rights Reserved.
Please see the file "licence.txt" for licencing details.
File:	GetDisplayWorkArea.cpp
Owner:	russf@gipsysoft.com
Purpose:	<Description of module>.
----------------------------------------------------------------------*/
#include "stdafx.h"
#pragma warning( disable: 4706 )
#define COMPILE_MULTIMON_STUBS
#include <multimon.h>

extern void GetDisplayWorkArea( HWND hwnd, RECT &rc );
extern void GetDisplayWorkArea( POINT pt, RECT &rc );

void GetDisplayWorkArea( HWND hwnd, RECT &rc )
{
	HMONITOR hMon = MonitorFromWindow( hwnd, MONITOR_DEFAULTTONEAREST );
	if( hMon )
	{
		MONITORINFO m = { sizeof( m ) };
		if( GetMonitorInfo( hMon, &m ) )
		{
			rc = m.rcWork;
		}
	}
}


void GetDisplayWorkArea( POINT pt, RECT &rc )
{
	HMONITOR hMon = MonitorFromPoint( pt, MONITOR_DEFAULTTONEAREST );
	if( hMon )
	{
		MONITORINFO m = { sizeof( m ) };
		if( GetMonitorInfo( hMon, &m ) )
		{
			rc = m.rcWork;
		}
	}
}

⌨️ 快捷键说明

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