怎样得到弹出对话框左上角在屏幕中的位置?我在对话框类的onsize中GetClientRect(&rect)可top和left都是0。 The GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CWnd* pParent = GetParent(); //Retrieve the old postion (in parent client coordinates) CRect oldPos; GetClientRect(&oldPos); ClientToScreen(oldPos); pParent->ScreenToClient(&oldPos); //Work out the new position (in parent client coordinates) CRect newPos(point.x - m_nDragOffset.x, point.y - m_nDragOffset.y, point.x - m_nDragOffset.x + m_nIconWidth, point.y - m_nDragOffset.y + m_nIconHeight); ClientToScreen(&newPos); pParent->ScreenToClient(&newPos); masterz() 不是说过了吗,GETWINDOWRECT(...) GetWindowRect()得到相对于屏幕的坐标,GetClientRect()得到相对于本程序窗口的坐标.在这里,你应该用前者 新手求救,怎样对对话框编代码?也就是代码我要写哪? 求一个局域网文本聊天程序 请教一个关于脚本编程和vc的配合问题~~ 我朋友猎狐的.NET技术与休闲社区初运行,欢迎大家去测试(www.lyhu.com/bbs),谢谢^_^ 将一个Dialog类中的值传递给CMyDoc,再利用CMyView将Doc中的值显示在窗口中,怎么作呢?? 各位大侠,这是怎么回事? 中止线程导致主对话框消失问题? 新建了个群 高分求: FTP实现原理 新手处女作:vc版2048 找上海的同学共同学习VC++! 如何使对话框程序执行就让整个屏幕背景变黑色??
CRect oldPos;
GetClientRect(&oldPos);
ClientToScreen(oldPos);
pParent->ScreenToClient(&oldPos); //Work out the new position (in parent client coordinates)
CRect newPos(point.x - m_nDragOffset.x, point.y - m_nDragOffset.y,
point.x - m_nDragOffset.x + m_nIconWidth, point.y - m_nDragOffset.y + m_nIconHeight);
ClientToScreen(&newPos);
pParent->ScreenToClient(&newPos);
在这里,你应该用前者