資源簡介
c++實現將窗體移動到擴展顯示器,默認系統設置主窗口在最左邊,擴展窗口在右側

代碼片段和文件信息
#include?“stdafx.h“
#include?“monitor.h“
bool?MoveWindowToVive_Montor(HWND?mhwndint?num)
{
if?(mhwnd?==?NULL)
{
return?false;
}
HMONITOR?hMainMontor?=?MonitorFromWindow(mhwndMONITOR_DEFAULTTOPRIMARY);
MONITORINFO?info;
info.cbSize?=?sizeof(MONITORINFO);
if?(!GetMonitorInfo(hMainMontor&info))
return?false;
for(int?i=0;i {
RECT?reMainMontor?=?info.rcMonitor;
POINT?mPt;
mPt.x?=?reMainMontor.right?+?1;
mPt.y?=?1;
HMONITOR?hNextMontor?=?MonitorFromPoint(mPtMONITOR_DEFAULTTONEAREST);
if?(!GetMonitorInfo(hNextMontor&info))
return?false;
}
RECT?reOtherMontor?=?info.rcWork;
return?SetWindowPos(mhwndNULLreOtherMontor.leftreOtherMontor.topreOtherMontor.rightreOtherMontor.bottomSWP_NOSIZE);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????772??2018-12-27?16:31??monitor.cpp
?????文件?????????202??2019-01-11?08:14??monitor.h
- 上一篇:雪花——OpenGL
- 下一篇:《C++版小游戲A10戰斗機源代碼》
評論
共有 條評論