2012-07-08, 23:52
(2012-07-08, 23:32)chris295 Wrote: 1. Pasting the mousetrap command throughout different areas in the script doesn't seem to work. If I paste the command after every string of the GUI command, you can see the mouse pointer move back and forth as the mousetrap command is executed when the GUI is created, image is displayed, program is launched, etc., but the overall effect is that the mouse pointer is still there because each time the mousetrap command is executed, the pointer returns to the center of the screen.
If this is done 3-4 times in less than a second, the pointer doesn't really have time to hide. If I paste the command more than a few times, the script can sometimes get hung up as it tries to execute the mousetrap command also. If I don't paste the command after every string in the GUI command, the cursor only hides for a second, flashes a few times and returns, what I'm guessing is each function of the GUI command changes focus of the windows or refreshes them in someway that deactivates the mousetrap command.
Ok. If the mousetrap function do not give good result there is another way to hide to mouse pointer with autoit. You need to include a new function :
Code:
Func _SetCursorState($bValue = 1)
DllCall('User32.dll', 'int', 'ShowCursor', 'int', $bValue)
EndFunc
If you call the function by _SetCursorState(0) it will hide the pointer. If you call the function by _SetCursorState(1) it will show the pointer.
(2012-07-08, 23:32)chris295 Wrote: 2. After I close the application, XBMC does not regain focus and stays minimized in the Taskbar until I click on it. I've tried the @SW_MAXIMIZE and WinSetOnTop code, neither worked. Maybe they aren't appropriate here and I need a different code?
Have you try with WinSetState("XBMC", "", @SW_MAXIMIZE)?
(2012-07-08, 23:32)chris295 Wrote: 3. When I close the application, you can see all the windows cycling through as the script calls for the GUI to close. It happens very fast and doesn't appear as actual windows, just as a few brief flashes of white and black with the mouse pointer displaying. I think this might be unavoidable since the GUI is the image itself and when it closes the different windows change focus.
Maybe you can try to callback the GUI before starting to close the application?
Here's my suggested code (not tested) :
Code:
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
HotKeySet("{ESC}", "Terminate")
Opt("WinTitleMatchMode", 2)
$app = "G:\xbmc\games\snes\snes9x-x64.exe"
$winname = "snes9x"
If $CmdLine[0] == 1 Then
_SetCursorState(0)
GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST))
GUICtrlCreatePic('C:\Users\user\Desktop\wallpaper.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
GUISetState()
Run("pssuspend XBMC.exe", "", @SW_HIDE)
Run($app & ' "' & $CmdLine[1] & '"',"",@SW_HIDE)
While 1
Sleep(100)
WEnd
EndIf
Func Terminate()
GUISetState()
ProcessClose( "snes9x-x64.exe" )
ProcessWaitClose( "snes9x-x64.exe" )
Run("pssuspend -r XBMC.exe", "", @SW_HIDE)
WinSetState("XBMC", "", @SW_MAXIMIZE)
_SetCursorState(1)
Exit 0
EndFunc
Func _SetCursorState($bValue = 1)
DllCall('User32.dll', 'int', 'ShowCursor', 'int', $bValue)
EndFunc