了Stack around the variable "rc" was corrupted
错误,试图测试此代码时损坏的堆栈(使用返回坐标那里移动鼠标)
请参阅下面的代码:同时使用MapWindowPoints
int TestPluginAPI::getmidX()
{
//RECT rect;
HWND hWnd;
hWnd = getBrowserHwnd();
RECT rc;
if(GetClientRect(hWnd, &rc)) // get client coords
{
MapWindowPoints(hWnd, NULL, reinterpret_cast<POINT*>(&rc.left), 2); // convert top-left x
MapWindowPoints(hWnd, NULL, reinterpret_cast<POINT*>(&rc.right), 2); // convert bottom-right x
MapWindowPoints(hWnd, NULL, reinterpret_cast<POINT*>(&rc.top), 2); // convert top-left y
MapWindowPoints(hWnd, NULL, reinterpret_cast<POINT*>(&rc.bottom), 2); // convert bottom-right y
return rc.left;
}
else {return 0;}
}
你能告诉我,什么是错的?
值得在使用它们之前阅读这些函数的文档:http://msdn.microsoft.com/en-us/library/windows/desktop/ dd145046(v = vs.85).aspx – LihO 2013-04-03 22:22:14
当你传递&rc.bottom并且说有两点时,你的堆栈会被破坏。只有一个。向微软购买一支雪茄,让你远离深沉的麻烦。 – 2013-04-03 22:26:14
为了好奇,你的意思是什么样的可怕的麻烦? – 2013-04-03 22:42:18