Jump to content
rm4453

Custom Stream GUI Using Autoit Gui Wrap

Recommended Posts

rm4453

Hey guys! I need to find a way to wrap an autoit gui around a game. I am planning on making a custom gui overlay for interacting with my stream, which will allow me to run giveaways and stuff like that. But I need to find a way to force the steam games to run inside my autoit gui... I have the following code so far credit to those I took code from and modified to suite my needs "can't remember who u are pls post if i owe ty to u" If I select notepad and launch it then it works great! and the notepad window is wrapped inside my gui. However if I try it with teamfortress 2 it won't work...

 

#include <Array.au3>
#include <File.au3>
#include <WinAPI.au3>
#include <GUIConstants.au3>

Local $msg, $hwnd, $WinHwnd

;===> UDV Start

$pid = 0
$Hidden = 0
$exe = 0
$sDrive = 0
$sDir = 0
$sFileName = 0
$sExtension = 0

;===> UDV End


$hwnd = GUICreate("hello")
$Open = GUICtrlCreateButton("Launch Game", 10, 30, 75, 25)
$Select = GUICtrlCreateButton("Select Game", 10,60,75,25)
GUISetState()

;===> UDF START

Func _GetWinHwnd($pid)
    $aWinlist = WinList()
    For $i = 1 To $aWinlist[0][0]
        If $pid = WinGetProcess($aWinlist[$i][0]) Then Return $aWinlist[$i][0]
    Next
EndFunc   ;==>_GetWinHwnd


Func _SetParentWindow($pid)
    $WinInfo = _GetWinHwnd($pid)
    $WinHwnd = ControlGetHandle($WinInfo, "", "")

    _WinAPI_SetParent($WinHwnd, $hwnd)
    _WinAPI_SetWindowLong($WinHwnd, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE)
    WinMove($WinHwnd, "", 0, 0)
EndFunc   ;==>_SetParentWindow

Func RedrawGui($RedrawMe)
    If ProcessExists($pid) And $Hidden = 0 Then
        GUICtrlSetState($RedrawMe, @SW_HIDE)
        $Hidden = 1
        sleep(50)
        _WinAPI_RedrawWindow($pid)
        Sleep(50)
    ElseIf $Hidden = 1 And Not ProcessExists($pid) Then
        GUICtrlSetState($RedrawMe, @SW_SHOW)
        $Hidden = 0
    EndIf
EndFunc


;===> UDF END

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            If ProcessExists($pid) Then
                ProcessClose($pid)
                GUICtrlSetState($Open, @SW_SHOW)
            Else
                Exit
            EndIf

        Case $Open
            GUICtrlSetState($Open, @SW_HIDE)
            Sleep(100)
            $pid = Run('"' & $exe & '" -game tf -steam')
            
            #cs
            This RUN CMD is custom made for testing with TF2 change to just $exe to select any exe you want to test with
            -game tf specifies to launch tf2 and -steam gets rid of insecure mode error
            #ce
            
            RedrawGui($Open)
            ProcessWait($pid)
            Sleep(5500)
            _GetWinHwnd($pid)
            _SetParentWindow($pid)

        Case $Select
            $exe = FileOpenDialog("Please select your game!", @ScriptDir, "Executable File (*.exe)", "1", "Process Selection")
            Sleep(50)
            FileChangeDir(@ScriptDir)
            _PathSplit($exe, $sDrive, $sDir, $sFileName, $sExtension)
    EndSwitch


WEnd

 

Edited by rm4453

Share this post


Link to post
Share on other sites
JLogan3o13

@rm4453 one would have thought that after 8 months on the forum and 45 posts you would have maybe given some thought to reading the forum rules, especially the part about game automation and how we're not going to support those questions. I suggest you do so now.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Similar Content

    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an inquiry and I hope to find the answer here
      I want to create a graphical user interface
      but I want to hide the system menu
      I mean the window menu
      Is this possible?
      If is possible please give me how to do that
      Thanks in advance
    • helmar
      By helmar
      I was playing around with simple GUI creation.  I tend to like parameter driven coding (in prior life (years ago) as Clipper/FoxPro/dBase coder).  Just wanted to see what I could do with a GUI.
      #Region options, includes Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode #include <GUIConstantsEx.au3> #EndRegion options, includes Global Const $nCols = 2, $nRows = 6, $nSpacer = 10, $nBtnWidth = 150, $nBtnHeight = 30 Global $xName = 0, $xID = 0 Global $nGUIWidth = ($nCols * $nBtnWidth) + (($nCols + 1) * $nSpacer) Global $nGUIHeight = ($nRows * $nBtnHeight) + (($nRows + 1) * $nSpacer) Global $hMainGUI = GUICreate("Calculated GUI", $nGUIWidth, $nGUIHeight, -1, -1) For $xRows = 1 to $nRows ;in this arrangement, tabbing is left to right, then next row For $xCols = 1 to $nCols ;reverse the order of this line with the prior line for top to bottom tabbing, then next col $xName += 1 $xID += 1 Global $Dummy = GUICtrlCreateButton("Button" & $xName, _ ($nBtnWidth * ($xCols - 1)) + (($xCols - 1) * $nSpacer) + $nSpacer, _ ($nBtnHeight* ($xRows - 1)) + (($xRows - 1) * $nSpacer) + $nSpacer, _ $nBtnWidth, _ $nBtnHeight) GUICtrlSetOnEvent($xID+2, "Handler") Next Next GUISetOnEvent($GUI_EVENT_CLOSE, "CloseApp") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func CloseApp() Exit EndFunc Func Handler() MsgBox(0,0,"Button " & @GUI_CtrlId - 2) EndFunc  
    • DynamicRookie
      By DynamicRookie
      Hey there!
       
      Is there a way to detect movement only for 1 specific window?

      HWnd is not really working, it still detects movement in all the windows within the region

      This is my script:
       
      ;Checksum actual HotKeySet("{f2}", 'exit_') MsgBox(0, '', '0') Beep(500, 2000) $Hwnd = WinActive('') while 1 $Checksum = PixelChecksum(211, 650, 1094, 914, 1, $Hwnd) If PixelChecksum(211, 650, 1094, 914, 1, $Hwnd) <> $Checksum Then For $i = 1 To 100 Beep(1000, 50) Next MsgBox(0, '', 'New message!', 1) EndIf WEnd Func exit_() Beep(500, 1000) Exit 0 EndFunc I just want to check whenever a message comes because the app i use doesn't give notifications properly.

      Any help is really appreciated!
    • PramodR
      By PramodR
      Can you please see whats wrong im doing in the below code? i can read few registry entry but not all for eg, i am able to get value of "Shell" Key from the registry path  but not AutoAdminLogon which has the value of "1", is there any change i have to do to read numeric values?
       Global  $shello = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","Shell" )
       ConsoleWrite("This is Hello"& $shello)
      above command returns proper value , but same command with AutoAdminLogon returns null as shown in below ? infact registry has the value of 1.
       Global  $shello = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon" )
       ConsoleWrite("This is Hello"& $shello)
    • Eminence
      By Eminence
      Hello,
      I've been searching on how to select the first row in my database which includes a time column based on the latest start_time date for today's date.
      This is my current code:
      Local $iCurrentDate = _Now() Local $sqlHandle = _dbOpen($sDbPath) Local $aResult, $iRows, $iCols _SQLite_GetTable2d($sqlHandle, "SELECT start_time FROM " & $srawDb & " ORDER BY datetime(start_time) DESC LIMIT 1", $aResult, $iRows, $iCols) _ArrayDisplay($aResult) _dbClose($sDbpath) What it does is it gets the first row entry in the database however it does not select the latest start_time entry in the database, it always select the first row. I've tried changing DESC to ASC to see if that will do it but the issue still remains. Any thoughts on this? Thanks in advance.
       
      *EDIT
      The date format in the database is by MM/DD/YYYY HH:MM:SS.
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.