试图让它工作使用 VisualStudio VC++ 我试图检测光标的位置,同时获取 x 和 y 并将其用于东西,但无论如何 - 会发生链接错误。
public: System::Void pictureDrag_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
POINT coord;
GetCursorPos(&coord);
int xx = coord.x, yy = coord.y;
pictureBox2->Location = Drawing::Point(xx, yy);
}
给我这两个链接错误
Stuff.obj : error LNK2028: unresolved token (0A000011) "extern "C" int __stdcall GetCursorPos(struct tagPOINT *)" (?GetCursorPos@@$$J14YGHPAUtagPOINT@@@Z) referenced in function "public: void __clrcall Stuff::Form1::pictureDrag_MouseDown(class System::Object ^,class System::Windows::Forms::MouseEventArgs ^)" (?pictureDrag_MouseDown@Form1@Stuff@@$$FQ$AAMXP$AAVObject@System@@P$AAVMouseEventArgs@Forms@Windows@4@@Z)
Stuff.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall GetCursorPos(struct tagPOINT *)" (?GetCursorPos@@$$J14YGHPAUtagPOINT@@@Z) referenced in function "public: void __clrcall Stuff::Form1::pictureDrag_MouseDown(class System::Object ^,class System::Windows::Forms::MouseEventArgs ^)" (?pictureDrag_MouseDown@Form1@Stuff@@$$FQ$AAMXP$AAVObject@System@@P$AAVMouseEventArgs@Forms@Windows@4@@Z)
请注意,开头有一个#include,我也尝试将 user32.lib 包含到项目中,但根本没有结果。代码本身非常简单,错过了一些重要的东西,这看起来像是我忘记了包含一些东西,但就是不知道是什么。我是 C++ 的新手,我们很快就要分手了!一旦我弄清楚这个。
向世界寻求帮助,再也受不了了。请帮助一个白痴!