2013-07-14, 15:45
Hey.
How do I get back when I close a PC game?!
That`s my code:
ProcessWait(" ' & $CmdLine[2] & '.exe")
Is that right to find the current game I play?!
Cheers.
How do I get back when I close a PC game?!
That`s my code:
Code:
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
Run("D:\HTPC\Programs\autotaskbarhider\TaskBarHider.exe -hide -exit")
_GDIPlus_Startup()
$GUI_Width = @DesktopWidth ;only with these macros other values will result in misplacement of the CD.
$GUI_Height = @DesktopHeight
$hGUI = GUICreate('MyGUI', $GUI_Width, $GUI_Height, 0, 0, $WS_POPUP)
GUICtrlCreatePic('D:\HTPC\Games\PC\screenshot\' & $CmdLine[2] & '.jpg', 0, 0, $GUI_Width, $GUI_Height)
GUISetState()
$hBmp_CD = _GDIPlus_ImageLoadFromFile('D:\HTPC\Games\PC\cartridge\' & $CmdLine[2] & '.png')
$hBmp_Gfx_CD = _GDIPlus_ImageGetGraphicsContext($hBmp_CD)
$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBmp = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hBmp_Gfx_CD)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2, $iHeight / 2)
$i = 0
Do
_GDIPlus_MatrixRotate($hMatrix, 3)
_GDIPlus_GraphicsSetTransform($hBmp_Gfx, $hMatrix)
;The CD is not at the Center perfectily, therefore some cliping would occur
_GDIPlus_GraphicsDrawImage($hBmp_Gfx, $hBmp_CD, -$iWidth / 2, -$iHeight / 2)
_GDIPlus_GraphicsDrawImage($hGUI_Gfx, $hBmp, ($GUI_Width / 2) - ($iWidth / 2), ($GUI_Height / 2) - ($iHeight / 2))
_GDIPlus_GraphicsClear($hBmp_Gfx, 0x0000000) ;Make the Background equal to the background of the GUI
Sleep(5)
$i = $i + 1
Until $i = 225
;memory release
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_GraphicsDispose($hBmp_Gfx)
_GDIPlus_GraphicsDispose($hGUI_Gfx)
_GDIPlus_GraphicsDispose($hBmp_Gfx_CD)
_GDIPlus_ImageDispose($hBmp)
_GDIPlus_ImageDispose($hBmp_CD)
_GDIPlus_Shutdown()
If $CmdLine[0] == 2 Then
GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST))
GUISetBkColor(0x000000)
GUISetState()
Run(@ComSpec & " /c " & '"' & $CmdLine[1] & '"', "", @SW_HIDE)
Run("pssuspend XBMC.exe", "", @SW_HIDE)
While 1
Sleep(100)
WEnd
EndIf
[b]ProcessWait(" ' & $CmdLine[2] & '.exe")[/b]
Run ( 'pssuspend -r XBMC.exe')
WinSetState("XBMC","", @SW_MAXIMIZE)
Run("D:\HTPC\Programs\nomousy\nomousy.exe", "", @SW_HIDE)
Run("D:\HTPC\Programs\autotaskbarhider\TaskBarHider.exe -show -exit")
Exit 0
ProcessWait(" ' & $CmdLine[2] & '.exe")
Is that right to find the current game I play?!
Cheers.