Jump to content

Running exe in a GUI window?


 Share

Recommended Posts

Hi!

Sorry, I do not have Solitaire.

But, I have Calculator.

Therefore, a exemple of code:

#include<guiconstants.au3>
#include<WindowsConstants.au3>

;opt("WinTitleMatchMode",3)
$hGui1 = GUICreate("GUI Embedder",400,400,-1,-1,BitOr($GUI_SS_DEFAULT_GUI ,$WS_CLIPCHILDREN))
GUISetState(@SW_SHOW)

$title="Calculatrice"     ;french
$title="Calculator"       ;english


ShellExecute("calc.exe")
WinWait($title,"",4)
$Handle = WinGetHandle($title)
$origParent = DllCall("user32.dll", "int", "SetParent", "hwnd", $Handle, "hwnd",$hGui1)
sleep(24)
WinSetState($Handle,"",@SW_MAXIMIZE)

While 1
    $nMSG = GUIGetMsg()    
    Switch $nMSG
  Case $GUI_EVENT_CLOSE
   ;set child back To Original parent or it will be destroyed with ouyr window
   DllCall("user32.dll", "int", "SetParent", "hwnd", $Handle, "hwnd", $origParent[0])
   Sleep(24)
   WinClose($Handle)
   Exit
EndSwitch
sleep(12)
WEnd
Edited by Michel Claveau
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...