Jump to content

Embed an external app in Gui ?


Recommended Posts

Well my friends i know that we can embed notepad,cmd,regedit etc.in a Gui.

But how we can make a portable app i.e. sumatra pdf to be embeded in a gui ( you know, to run inside the gui )

Is that possible for an external app to run in this way..

After google a bit i found in a forum about a guy that embeded an app in a Autoit Gui ( the app is DX studio ) has a link with the source but i can't be a member to this forum, probably they don't sent email confirmations any more..

Anyway if any knows something it would be great....

this is just an embed regedit example from Holger...

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("Test", 800, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
$PID    = Run(@WindowsDir & "\regedit.exe", "", @SW_HIDE)
$hWnd    = 0
$stPID    = DllStructCreate("int")
Do
    $WinList = WinList()
    For $i = 1 To $WinList[0][0]
        If $WinList[$i][0] <> "" Then
            DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID))
            If DllStructGetData($stPID, 1) = $PID Then
                $hWnd = $WinList[$i][1]
                ExitLoop
            EndIf
        EndIf
    Next
    Sleep(100)
Until $hWnd <> 0
$stPID = 0
If $hWnd <> 0 Then
    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20)
    $nExStyle = $nExStyle[0]
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI)
    WinSetState($hWnd, "", @SW_SHOW)
    WinMove($hWnd, "", 0, 0, 600, 400)
EndIf
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
WEnd

[font="verdana, geneva, sans-serif"] [/font]

Link to comment
Share on other sites

only put the path of sumatra pdf.

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("Test", 800, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
$PID    = Run("C:UsersusuarioDesktopSumatraPDF-2.1.1SumatraPDF.exe", "", @SW_HIDE)
$hWnd    = 0
$stPID    = DllStructCreate("int")
Do
    $WinList = WinList()
    For $i = 1 To $WinList[0][0]
        If $WinList[$i][0] <> "" Then
            DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID))
            If DllStructGetData($stPID, 1) = $PID Then
                $hWnd = $WinList[$i][1]
                ExitLoop
            EndIf
        EndIf
    Next
    Sleep(100)
Until $hWnd <> 0
$stPID = 0
If $hWnd <> 0 Then
    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20)
    $nExStyle = $nExStyle[0]
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI)
    WinSetState($hWnd, "", @SW_SHOW)
    WinMove($hWnd, "", 0, 0, 600, 400)
EndIf
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
WEnd

work correctly.

Edited by Danyfirex
Link to comment
Share on other sites

I salute you Danyfirex ;)

Yes that works with sumatra pdf.....Thank you very much my friend

i cant run a portable cmd but now i know, and ill try to find a workaround

Thank you again for the assistance Dany

Edited by armoros

[font="verdana, geneva, sans-serif"] [/font]

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

×
×
  • Create New...