Mouse Cursor Toggle

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Fashion
    Forum Member
    • Sep 2003
    • 83

    Mouse Cursor Toggle

    Hi guys, i would like to be able move mouse cursor automaticaly from one coordinate to another and so on. I used the USER32.DLL function but i'm not sure to use it correctly.

    For exemple, i need to place the cursor at (50,50) and 1 second later at (100,100) and another second later (50,50) and so on.

    This is the code i tried but it gives me an error and force the application to close. I start the toggle movement using a simple button.

    What's wrong with my code ?


    Thanks a lot,

    Stephen


    -- wait one second
    min = 1;
    max = 1000;
    for count = min, max do
    end

    -- move cursor to (50,50)
    result = DLL.CallFunction("AutoPlay\\Docs\\user32.dll", "SetCursorPos", "50,50", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);

    -- wait one second
    min = 1;
    max = 1000;
    for count = min, max do
    end

    -- move cursor to (100,100)
    result = DLL.CallFunction("AutoPlay\\Docs\\user32.dll", "SetCursorPos", "100,100", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);

    AND EVENTUALY LOOP HERE
  • Worm
    Indigo Rose Customer
    • Jul 2002
    • 3967

    #2
    First thing that I see, is that you shouldn't browse to the User32.dll and have AMS copy it to the Docs folder. It's not a safe way to go. Depending on OS's the User32.dll will be different.

    Instead of browsing to the dll, type the path like this:
    Code:
    result = DLL.CallFunction(_SystemFolder .. "\\user32.dll", "SetCursorPos", "50,50", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
    Using _SystemFolder will allow you to use the User32.dll on the end-users system. This way you are sure to be using the correct version for their system too.

    Other than that, the call looks right to me. Remember though that the X and Y are Screen Coordinates, not coordinates within your window.

    Comment

    Working...
    X