Jump to content

Mouse Move in Created Desktop via _WinAPI


Recommended Posts

hello,
 
i added following codes for mouse move. but could not see any mouse movements
need your valuable help
 
thanks
 
 
 
 
 
Local $hPrev = _WinAPI_GetThreadDesktop(_WinAPI_GetCurrentThreadId())
Local $hDesktop = _WinAPI_CreateDesktop('MyDesktop', BitOR($DESKTOP_CREATEWINDOW, $DESKTOP_SWITCHDESKTOP))
 
 
If Not $hDesktop Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Unable to create desktop.')
    Exit
EndIf
 
; Switch to the newly created desktop
_WinAPI_SwitchDesktop($hDesktop)
 
; Run "calc.exe" on "MyDesktop" and wait until a process will not be closed by user
Local $pText = _WinAPI_CreateString('MyDesktop')
Local $tProcess = DllStructCreate($tagPROCESS_INFORMATION)
Local $tStartup = DllStructCreate($tagSTARTUPINFO)
DllStructSetData($tStartup, 'Size', DllStructGetSize($tStartup))
DllStructSetData($tStartup, 'Desktop', $pText)
 
 
;_WinAPI_CreateProcess('', @SystemDir & 'calc.exe', 0, 0, 0, $CREATE_NEW_PROCESS_GROUP, 0, 0, DllStructGetPtr($tStartup), DllStructGetPtr($tProcess))
;~ Then
 
_WinAPI_Mouse_Event($MOUSEEVENTF_MOVE,100,100)
_WinAPI_Mouse_Event($MOUSEEVENTF_MOVE, 653, 454)
_WinAPI_Mouse_Event($MOUSEEVENTF_MOVE, 100, 0, 0, 0)
_WinAPI_Mouse_Event(BitAND($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_MOVE), 100, 0, 0, 0)
 
;~ ProcessWaitClose(DllStructGetData($tProcess, 'ProcessID'))
MouseMove(1329,99)
Edited by afimafis
Link to comment
Share on other sites

Hi,

Welcome to the autoit forum :)

Please use autoit code tags to post your code, and also post a working code (here the includes are missing).

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

"The desktops associated with the interactive window station, Winsta0, can be made to display a user interface and receive user input, but only one of these desktops at a time is active. This active desktop, also known as the input desktop, is the one that is currently visible to the user and that receives user input."

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

Use controlsend() / controlclick() instead.

Link to comment
Share on other sites

"The desktops associated with the interactive window station, Winsta0, can be made to display a user interface and receive user input, but only one of these desktops at a time is active. This active desktop, also known as the input desktop, is the one that is currently visible to the user and that receives user input."

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

Use controlsend() / controlclick() instead.

 

thanks i tried controlsend and controlclick . but they did not work

codes below do not work ?

_WinAPI_Mouse_Event($MOUSEEVENTF_MOVE,100,100)
_WinAPI_Mouse_Event($MOUSEEVENTF_MOVE, 653, 454)
_WinAPI_Mouse_Event($MOUSEEVENTF_MOVE, 100, 0, 0, 0)
Link to comment
Share on other sites

The control* functions are the only ones which WILL work. Test your application automation on the default desktop first to ensure the calls are all right. Only after that add the functions to run it one a new (not visible) desktop.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...