2

如何SetCursorPos从 WindowsRunDll32应用程序正确调用该函数?

如果我尝试这个,它会将光标发送到右下角:

RunDll32.exe user32.dll,SetCursorPos 100, 100

但我将正确的值传递给它的参数:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms648394%28v=vs.85%29.aspx

PS:我对诸如NirCMD应用程序之类的替代方案不感兴趣,我知道它们,我只想知道我所做的问题的答案,谢谢。

4

1 回答 1

7

这是不可能的。RunDll32只能调用具有此签名的函数:

void CALLBACK EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);

所以如果你这样做

RunDll32.exe user32.dll,SetCursorPos 100 100

你告诉RunDll32.exe这样做:

SetCursorPos(0x314159, 0x265358, "100 100", 1)

...如果前两个参数不在您的控制范围内(例如,在我的机器中,调用将光标移动到右上角)。

来自文档的更多信息:

hwnd - window handle that should be used as the owner window for
       any windows your DLL creates
hinst - your DLL's instance handle
lpszCmdLine - ASCIIZ command line your DLL should parse
nCmdShow - describes how your DLL's windows should be displayed
于 2015-04-04T13:31:35.403 回答