rm4453

Custom Stream GUI Using Autoit Gui Wrap

2 posts in this topic

#1 ·  Posted (edited)

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



@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

    • X_xkijux_x
      By X_xkijux_x
      Ok so im using this program. clarify for school. I would like to have a program that takes every word i type in microsoft word and searches on it in claryfi. is this possible. I would like to have the program not stopping me from typing more after that word. Like when i type a word it auto search it on clarify without making me stop typing and if i want to change i can do that and if im fine that word i can just keep typing and it will search after the next word. 
    • Miliardsto
      By Miliardsto
      Is this possible to make program works like in diagram? There is so much encryption methods and UDFs are they give security? If the $Address will be crypted with some encryption algorithm could be possible to get the value of $Address in easy way? Of course We know its easy too look into autoit code and get value of variable and so We dont want to anyone see $Address value - there are functions Could func1.au3, func2.au3.. be for example func1.php or other type of file? As we know .php files are unnable to see. For example func1 would be read by FileRead() and then Execute() Is this generally possible to do?
      Will it give secure?
      What do you think about? Maybe there is something wrong in this concept or missed.

    • JaredStroeb
      By JaredStroeb
      I need to open an application and send it keys in Session 0.  I have exe's working locally, I can see the application open in session 0 through interactive services, but my send commands do not go to the application.  The following article running-autoit-session-0, directs me to use ControlSend() however my application has no controls that can be identified by AutoIt v3 Window Info.  Get All Windows Controls also returned nothing for the application's handle.  
      What are my options?  
      Can this be done with AutoIt?
      Is there a different "relatively simple" library/tool to use? (I am familiar with C# if there is a viable library there )

       
    • Miliardsto
      By Miliardsto
      Hello.
      Drag option works only on parent window but as we can see on the parent gui is showed up child gui (on the right side with the color).
      Desired action is when we want to drag whole program we can also drag child gui and child gui will drag with parent gui.
      How to do this?
       
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> GUIRegisterMsg($WM_NCHITTEST, "_NCHITTEST") $hGUI = GUICreate("Test", 500, 500, -1, -1) $cButton_0 = GUICtrlCreateButton("Child 0", 10, 10, 80, 30) $cButton_1 = GUICtrlCreateButton("Child 1", 10, 50, 80, 30) $cButton_2 = GUICtrlCreateButton("Child 2", 10, 90, 80, 30) GUISetState(@SW_SHOW, $hGUI) ; guis Global $hChild_[3] Global $countGUI = UBound($hChild_) - 1 ;MsgBox("","",$countGUI) ; licznik dla GUI Global $gui = 0 $hChild_[0] = GUICreate("Child 0", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFF0000) GUISetState(@SW_SHOW, $hChild_[0]) $hChild_[1] = GUICreate("Child 1", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0x00FF00) GUISetState(@SW_HIDE, $hChild_[1]) $hChild_[2] = GUICreate("Child 2", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0x0000FF) GUISetState(@SW_HIDE, $hChild_[2]) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_0 _All_Hide() GUISetState(@SW_SHOW, $hChild_[0]) $gui = 0 Case $cButton_1 _All_Hide() GUISetState(@SW_SHOW, $hChild_[1]) $gui = 1 Case $cButton_2 _All_Hide() GUISetState(@SW_SHOW, $hChild_[2]) $gui = 2 EndSwitch WEnd Func _All_Hide() GUISetState(@SW_HIDE, $hChild_[0]) GUISetState(@SW_HIDE, $hChild_[1]) GUISetState(@SW_HIDE, $hChild_[2]) EndFunc Func _NCHITTEST($hWnd, $uMsg, $wParam, $lParam) If $hWnd = $hGUI Then Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16),0xFFFF)- $aPos[1]) < 500 Then Return $HTCAPTION EndIf Return $GUI_RUNDEFMSG EndFunc  
    • nassausky
      By nassausky
      Hey all,
      Has anyone created any queries for youtube? I was thinking it might be something like this but can't quite figure it out:
      $oIE = _IECreateEmbedded() _IENavigate($oIE,"https://www.youtube.com") Local $oForms = _IETagNameGetCollection($oIE, "form") Local $sTxt = "" For $oForm In $oForms If $oForm.id = "masthead-search" Then $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs If $oInput.id = "masthead-search-term" Then _IEFormElementSetValue($oInput, "cards") _IEFormSubmit($oForm) EndIf Next EndIf Next