GetWindowRect获得窗口尺寸的问题

来源:互联网 发布:如何诊断网站seo 编辑:程序博客网 时间:2024/05/29 12:30

GetWindowRect函数获得的窗口尺寸应该是窗体相对于屏幕左上角的尺寸,也就是说获得的left和top值应该是大于0的。可是当在OnInitDialog中使用此函数时,获得的尺寸的left和top值始终是0,0。在MSDN上查阅了OnInitDialog,上面写道:This message is sent to the dialog box during the CreateCreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed.也就是说当调用该消息函数时窗体还未显示出来,此时使用GetWindowRect所获得的窗口的left,top值是不正确的。

原创粉丝点击