Sign in to follow this  
Followers 0
armoros

Embed an external app in Gui ?

3 posts in this topic

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]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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]

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • Marc
      By Marc
      Hi Folks,
      I've been very fond of portable software. Some of the portable programs are quite large, so to make the using fancier, I started to compress the portable applications into a WinRar SFX Archive which extracts the software to the tempdir, starts the software and afterward deletes the whole temp Dir.
      But it got cumbersome to manually extract the icon from the exe, make all necessary settings in the WinRar GUI - so I wrote this script. Nothing spectacular, but (in my eyes) very useful. After that, I added some other options to make it a little more versatile.
      Features:
      if we have a 32Bit and a 64Bit version, it can launch the correct Version (32Bit or 64Bit) fitting to the system the SFX is started on (contains a small exe file "universal_launcher.exe" which expects two parameters  for the 32Bit.exe and 64Bit.exe, checks the current system for 64Bit and then runs the correct file). Powerbasic Sourcecode of the exe file is included, of course. automatically extracts the icon from the chosen exe and uses it as icon for the SFX if the chosen exe file has a version number in it, the version is put in the resulting SFX's filename can just extract the files to a user-chosen directory OR can just extract the files to the program files directory (and, optionally, create a desktop shortcut) OR extract the files to a temp directory and run an exe Have fun with it
      best regards,
      Marc

      MakeSFX.zip
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning guys
      I was trying to not open another post, writing here my little issue, but seems that no one cares about, and so, I'm opening another post
      What I'm trying to do, is detect the event close sent from the virtual keyboard.
      Why?
      Because, I have an application which, when I set the focus on a textbox, if the virtual keyboard does not exist, then it is created, else, it's not created
      But, everytime I try to close the virtual keyboard, the focus remains on the textbox, and another $EN_FOCUS event it's launched and detected from my WM_COMMAND, and so, the virtual keyboard is opened again. 
      How can I solve this little "issue"? 
      I was trying to detect the event sent from the virtual keyboard, storing the handle of it in a variable, and setting:
      GUISetOnEvent($GUI_EVENT_CLOSE, "CloseVK", $hVirtualKeyboard) without any result.
      Can someone please help me?
      Thanks  
      EDIT:
      Here I'd like to see @Melba23, @water, @Danyfirex...
       
    • bawldiggle
      By bawldiggle
      How do I sync portable SciTE4AutoIt3 with portable AutoIt3 ?
      I have spent hours trawling through FAQs, this forum, and general searches on the web, without any luck
      I would prefer to use portable setup for AutoIt and SciTE etc.  I have downloaded portable ZIP but have not extracted it in case the order of extracting is critical.
      Thank you
    • Hasoth
      By Hasoth
      Hi,
      I've encountered a problem while I tried to close popup in application that is using embeded GUI object. If site has function "onbeforeunload" asking if you really want to exit you will get a popup. In embeded gui object it completly freezes functions and I can't click/close/do anything. I've created sample code with microsoft function example and in external window. Any idea how to close popup in GUI embeded IE? I've tried navigating using _IENavigate($oIE, $sURL, 0) or  changing focus _IEaction($oIE,"focus") but nothing works.
      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <IE.au3> HotKeySet("{F1}", "myExit") ;GUI setup $GUI_main = GUICreate("Menu", 800, 800, -1, -1) Global $oIE =_IECreateEmbedded() $ObjectIE = GUICtrlCreateObj($oIE, 0, 30, 800, 770) $cButton1 = GUICtrlCreateButton("Start test inside GUI window", 0, 0, 400, 30) $cButton2 = GUICtrlCreateButton("Start test outside GUI window", 400, 0, 400, 30) GUISetState(@SW_SHOW, $GUI_main) ;GUI While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_main Case $ObjectIE Case $cButton1 fTestFunction1() Case $cButton2 fTestFunction2() EndSwitch WEnd ;function inside GUI Func fTestFunction1() Local $sURL = "http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onbeforeunload.htm" $oIE.Navigate($sURL) _IELoadWait($oIE) $oIE.Navigate("https://www.google.com") MsgBox($MB_TOPMOST, "", "should appear while question box opened", 2) Sleep(2500) Send("!o") EndFunc ;function outside GUI Func fTestFunction2() Local $sURL = "http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onbeforeunload.htm" $oSecondIE = _IECreate ($sURL) _IELoadWait($oSecondIE) $oSecondIE.Navigate("https://www.google.com") MsgBox($MB_TOPMOST, "", "should appear while question box opened", 2) Sleep(2500) Send("!o") EndFunc ;shortcut to exit Func myExit() GUIDelete($GUI_main) Exit EndFunc  
    • AlHazred
      By AlHazred
      Just like it says in the title. A scripter from my company gave me a script to make it run, but he's not around anymore, and my drive finally failed with no working backup.
      I run PortableRoboForm (http://www.roboform.com/for-usb-roboform2go-windows) version 6 from a USB drive to automate password management for hundreds of accounts with different passwords.RoboForm lets me do this, and they even have a Portable version, but it's not that portable and I'd like to use it inside a PortableApps (http://portableapps.com/) launcher.
      I'd like to create a script to go to the root of the USB drive and run "PortableRoboForm.exe". PortableApps only sees executables in subdirectories of the \PortableApps folder of the USB drive. RoboForm2Go only installs and executes in the root directory of the USB drive.
      I tried using the fantastic little _GetFileDrive function, but I keep getting an error indicating it's trying to run the file in the subdirectory so obviously I'm not using _GetFileDrive right. Any help for a newbie would be appreciated.
      ; Change the working directory to the root of this file. FileChangeDir(_GetFileDrive(@ScriptDir)) ; Run the PortableRoboForm executable. Run(PortableRoboForm.exe,"") ; Get the drive letter of a filepath. Idea from _PathSplit. Func _GetFileDrive($sFilePath) Return StringLeft($sFilePath, StringInStr($sFilePath, ":", 2, 1) + 1) EndFunc ;==>_GetFileDrive EDIT: Nevermind, found the option to set it up to run from the PortableApps menu.