Sign in to follow this  
Followers 0
afimafis

Mouse Move in Created Desktop via _WinAPI

10 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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.

Share this post


Link to post
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)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

i tested many times my application but no any reaction from "control functions". it works well in normal windows screen.. any help ??

thanks

Share this post


Link to post
Share on other sites

Is the screen locked when you test?

 

locked means ?

Share this post


Link to post
Share on other sites

Seriously?

OK....

Locked as in you have to enter a password to get back the desktop.

no bro. so problem still exists . any idea ? thanks

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0