如何取得一个窗口的位置?

fanzai 2006-03-30 07:20:43
很简单、但是让我郁闷了很久的问题:
我只知道GetWindowRect函数,但是取回的是窗口除去标题栏的客户区域。

要知道窗口的位置用什么函数?
...全文
103 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
fanzai 2006-03-30
  • 打赏
  • 举报
回复
不好意思,我好像搞错什么东西了~~
YufengShi 2006-03-30
  • 打赏
  • 举报
回复
GetWindowRect得到整个窗口在屏幕中的矩形区域.
Maxwell 2006-03-30
  • 打赏
  • 举报
回复
楼主是说不要那个东西。要窗口在屏幕中的位置吧。
Steven7 2006-03-30
  • 打赏
  • 举报
回复
如果只要 “取回的是窗口除去标题栏的客户区域”
那么上面几位朋友的GetClientRect都不行,ClientRect不带标题栏、菜单栏、工具栏
可以GetWindowRect后剪去标题栏的rect
bm1408 2006-03-30
  • 打赏
  • 举报
回复
msdn is the best friend
Maxwell 2006-03-30
  • 打赏
  • 举报
回复
CWnd::GetWindowRect
void GetWindowRect( LPRECT lpRect ) const;

Parameters

lpRect

Points to a CRect object or a RECT structure that will receive the screen coordinates of the upper-left and lower-right corners.

Remarks

Copies the dimensions of the bounding rectangle of the CWnd object to the structure pointed to by lpRect. The dimensions are given in screen coordinates relative to the upper-left corner of the display screen. The dimensions of the caption, border, and scroll bars, if present, are included.
sunmz_wjxy 2006-03-30
  • 打赏
  • 举报
回复
GetClientRect(rect);
ClientToScreen(&rect);试试
Maxwell 2006-03-30
  • 打赏
  • 举报
回复
GetWindowRect就是取回窗口位置的,GetClientRect才是你说的取客户区域的函数。

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧