How I could properly call the SetCursorPos
function from windows RunDll32
application?
If I try this, it sends the cursor to bottom-right corner:
RunDll32.exe user32.dll,SetCursorPos 100, 100
But I'm passing the proper values to its parameters:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648394%28v=vs.85%29.aspx
PS: I'm not interested in alternatives like for example NirCMD application, I know them, I only would like to know the answer to the question I did, thankyou.
This isn't possible. RunDll32
can only call functions with this signature:
void CALLBACK EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);
So if you do
RunDll32.exe user32.dll,SetCursorPos 100 100
You are telling RunDll32.exe
to do this:
SetCursorPos(0x314159, 0x265358, "100 100", 1)
...were the first two parameters are not in your control (for example, in my machine the call moves the cursor to the upper right).
More info from the docs:
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