MFC获取游戏窗口的位置和大小

MFC获取游戏窗口的位置和大小,第1张

你在本对前仿话框类中用GetWindowRect 肯定只能获得本窗口的啊

用 ::GetWindowRect( ), 第一个参数是目标猜悔颤窗口的HWND (注意前面有穗败两个冒号)

void CMainFrame::OnViewNewtool()

{

// TOD Add your command handler code here

GetWindowRect( &m_toolRect ) //m_toolRect是用来存贮工键肆具栏浮动时的位置的,稿旦轿是个类成员变量

if ( m_newToolBar.IsFloating() )

{

m_newToolBar.GetWindowRect( &m_toolRect ) //获取工具栏位置,并存贮在m_toolRect中

}

else

{

m_toolRect = CRect( 0,0,0,0 )

}

if ( m_newToolBar.IsWindowVisible() )

{

m_newToolBar.ShowWindow( SW_HIDE )

}

else

{

m_newToolBar.ShowWindow( SW_SHOW )

}

RecalcLayout()

DockControlBar( &m_newToolBar )

if ( !m_toolRect.IsRectEmpty() /*&&m_newToolBar.IsWindowVisible()*/ )

{

FloatControlBar( &m_newToolBar,CPoint( m_toolRect.left,m_toolRect.top ) ) //使工具栏浮动到CPoint所指定的位置迟烂

}

}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12350949.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-22
下一篇2023-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存