Jump to content

Question regarding opening prog inside of Guibox


Recommended Posts

Ok so I've gotten this far but cant seem to open a program (Diablo II) inside of it. I quess im a lil slow lol, I've been reading the help me files and what not, but I quess i'm really not sure what to be looking for as far as what I need to do.

This is the code I have so far.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Owner\Desktop\MyNewGui\forms\New Form.kxf
$Form1_1 = GUICreate("Diablo II", 802, 675, 233, 51, -1, -1)
GUISetIcon("D:\003.ico")
$GroupBox1 = GUICtrlCreateGroup("", -8, 1, 801, 601, -1, $WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Graphic1 = GUICtrlCreateGraphic(0, 0, 796, 604)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Pause = GUICtrlCreateButton("Pause", 641, 611, 75, 25, $WS_BORDER)
$UnPause = GUICtrlCreateButton("UnPause", 722, 611, 75, 25, $WS_BORDER)
$Button1 = GUICtrlCreateButton("Play", 16, 611, 75, 25, $WS_BORDER)
$Button2 = GUICtrlCreateButton("Stop", 95, 611, 75, 25, $WS_BORDER)
$Button3 = GUICtrlCreateButton("Back", 176, 611, 75, 25, $WS_BORDER)
$Button4 = GUICtrlCreateButton("Next", 258, 611, 75, 25, $WS_BORDER)
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Pause
        Case $UnPause
        Case $Button1
        Case $Button2
        Case $Button3
        Case $Button4
    EndSwitch
WEnd

Eventually what I plan on doing with this is opening D2 in the window. Then useing the pause/unpause button for the scripts while in game. and also the play button, etc to controll my winamp for music while playing.

Any Help in this matter would be greatly apprieciated. and as always Thank you in advance for takeing the time to read and hopefully respond.

Edited by XxxKills
Link to comment
Share on other sites

Ok, spent the last 4 hours searching the forums, and havnt found what I was looking for. again. which is what I did before i posted in the first place. But I had seen something on here a few days ago. but havent been able to find it again. Im not realy sure what Im looking for is called. can some one point me in the right direction.

Thanks in advance.

Link to comment
Share on other sites

If its possible. I want to create a frame around the D2 screen with a pause button and such for pauseing the script i would be runnig.

try the script i have in the first post and you will get a better idea of what I mean.

Link to comment
Share on other sites

Ok, let me be more specific, I want my script to run in the screen part of the gui that is created, basically Diablo in a non minimizing screen:

Here is the code for the screen.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Owner\Desktop\MyNewGui\forms\New Form.kxf
$Form1_1 = GUICreate("Diablo II", 802, 675, 233, 51, -1, -1)
GUISetIcon("D:\003.ico")
$GroupBox1 = GUICtrlCreateGroup("", -8, 1, 801, 601, -1, $WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Graphic1 = GUICtrlCreateGraphic(0, 0, 796, 604)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Pause = GUICtrlCreateButton("Pause", 641, 611, 75, 25, $WS_BORDER)
$UnPause = GUICtrlCreateButton("UnPause", 722, 611, 75, 25, $WS_BORDER)
$Button1 = GUICtrlCreateButton("Play", 16, 611, 75, 25, $WS_BORDER)
$Button2 = GUICtrlCreateButton("Stop", 95, 611, 75, 25, $WS_BORDER)
$Button3 = GUICtrlCreateButton("Back", 176, 611, 75, 25, $WS_BORDER)
$Button4 = GUICtrlCreateButton("Next", 258, 611, 75, 25, $WS_BORDER)
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Pause
        Case $UnPause
        Case $Button1
        Case $Button2
        Case $Button3
        Case $Button4
    EndSwitch
WEnd

and part of the script that I want to run in the screen.

Func Diablo()
    Run($Path & $argument)
    WinWaitActive("Diablo II")
    WinMove("Diablo II", "", 0, 0)
    Sleep(1000)
    Send("{ENTER}")

So does tht help. still ant fiqure it out, been searching for hours.eyes hurt and burn.

Link to comment
Share on other sites

Do you mean this?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Owner\Desktop\MyNewGui\forms\New Form.kxf
$Form1_1 = GUICreate("Diablo II", 802, 675, 233, 51, -1, -1)
GUISetIcon("D:\003.ico")
$GroupBox1 = GUICtrlCreateGroup("", -8, 1, 801, 601, -1, $WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Graphic1 = GUICtrlCreateGraphic(0, 0, 796, 604)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Pause = GUICtrlCreateButton("Pause", 641, 611, 75, 25, $WS_BORDER)
$UnPause = GUICtrlCreateButton("UnPause", 722, 611, 75, 25, $WS_BORDER)
$Button1 = GUICtrlCreateButton("Play", 16, 611, 75, 25, $WS_BORDER)
$Button2 = GUICtrlCreateButton("Stop", 95, 611, 75, 25, $WS_BORDER)
$Button3 = GUICtrlCreateButton("Back", 176, 611, 75, 25, $WS_BORDER)
$Button4 = GUICtrlCreateButton("Next", 258, 611, 75, 25, $WS_BORDER)
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Pause
        Case $UnPause
        Case $Button1
            Diablo()
        Case $Button2
        Case $Button3
        Case $Button4
    EndSwitch
WEnd

Func Diablo()
    Run($Path & $argument)
    WinWaitActive("Diablo II")
    WinMove("Diablo II", "", 0, 0)
    Sleep(1000)
    Send("{ENTER}")
EndFunc   ;==>Diablo

8)

NEWHeader1.png

Link to comment
Share on other sites

This should do it!!! ...

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>




#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Owner\Desktop\MyNewGui\forms\New Form.kxf
$Form1_1 = GUICreate("Diablo II", 802, 675, 233, 51, -1, -1)
GUISetIcon("D:\003.ico")
$GroupBox1 = GUICtrlCreateGroup("", 1, 1, 801, 601, -1, $WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Graphic1 = GUICtrlCreateGraphic(0, 0, 796, 604)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Pause = GUICtrlCreateButton("Pause", 641, 611, 75, 25, $WS_BORDER)
$UnPause = GUICtrlCreateButton("UnPause", 722, 611, 75, 25, $WS_BORDER)
$Button1 = GUICtrlCreateButton("Play", 16, 611, 75, 25, $WS_BORDER)
$Button2 = GUICtrlCreateButton("Stop", 95, 611, 75, 25, $WS_BORDER)
$Button3 = GUICtrlCreateButton("Back", 176, 611, 75, 25, $WS_BORDER)
$Button4 = GUICtrlCreateButton("Next", 258, 611, 75, 25, $WS_BORDER)
GUISetState()
#EndRegion ### END Koda GUI section ###

;*** Example.....
Run("notepad.exe")
WinWait("")
$handle = WinGetHandle("")
XSkinRun($Form1_1, $handle, 0, 0, 796, 600)
; *** end example....


While WinExists($handle) ; change to whatever
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Pause
        Case $UnPause
        Case $Button1
            Diablo()
        Case $Button2
        Case $Button3
        Case $Button4
    EndSwitch
WEnd

Func Diablo()
    ;Run($Path & $argument)
    WinWaitActive("Diablo II")
    WinMove("Diablo II", "", 0, 0)
    Sleep(1000)
    Send("{ENTER}")
    ; for you.......
    $handle = WinGetHandle("Diablo II")
    XSkinRun($Form1_1, $handle, 0, 0, 796, 600)
EndFunc   ;==>Diablo

Func XSkinRun($XPID2, $XhWnd, $X, $Y, $XX, $YY)
    $oxStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $XPID2, "int", -16)
    DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $XPID2, "int", -16, "long", BitOR($oxStyle[0], $WS_CLIPCHILDREN))
    $ostyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $XhWnd, "int", -16)
    DllCall("user32.dll", "int", "SetParent", "hwnd", $XhWnd, "hwnd", $XPID2)
    DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $XhWnd, "int", -16, "long", BitOR($WS_POPUP, $WS_CHILD, $WS_VISIBLE, $WS_CLIPSIBLINGS))
    GUISetState()
    WinMove($XhWnd, "", $X, $Y, $XX, $YY)
    WinSetState($XhWnd, "", @SW_SHOW)
    WinActivate($XhWnd)
    Return 1
EndFunc   ;==>XSkinRun

8)

NEWHeader1.png

Link to comment
Share on other sites

OMG!!!!!!!!!!!!!! I love you , if I was a dog I think I would hump your leg. Thank You so much. I've been trying it with parent and sibling but couldnt get it to work, I had almost given up on it.

Thank you very,very much sir.

Thanks to this I understand how some of the functions are used(quite a bit better) and how they are called.

Edited by XxxKills
Link to comment
Share on other sites

Can GUI_DockAuto be used to make everything resize when entering the game? When you actually enter the game the screen size changes to a bit smaller.

Just wondering if there was a way to do it without haveing to rewrite the whole script.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...