Sign in to follow this  
Followers 0
AzKay

Run app in a GUI

14 posts in this topic

I had this script somewhere before, I saw it posted.

I cant seem to find it anymore though, I believe Larry posted it.

I believe, What it did was, You have the GUI, And the application ran INSIDE the GUI,

You can move the app, via its title bar, etc. But it cant be moved out of the GUI.

Any ideas?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



Maybe GUI Hole plus some checks?

Share this post


Link to post
Share on other sites

Here, It was like this:

#343485

Except, Instead of it being another GUI, Its the program.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I had this script somewhere before, I saw it posted.

I cant seem to find it anymore though, I believe Larry posted it.

I believe, What it did was, You have the GUI, And the application ran INSIDE the GUI,

You can move the app, via its title bar, etc. But it cant be moved out of the GUI.

Any ideas?

If you can open it as an object, you can embed it in a control. Run the help file demo for _IECreateEmbedded().

I suspect this can be done with ANY app you can open as an object, because the code inside IE.au3 for _IECreateEmbedded() is just:

Func _IECreateEmbedded()
    Local $o_object = ObjCreate("Shell.Explorer.2")
    ; ...error handling snipped
    SetError($_IEStatus_Success)
    Return $o_object
EndFunc   ;==>_IECreateEmbedded

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

If you can open it as an object, you can embed it in a control. Run the help file demo for _IECreateEmbedded().

I suspect this can be done with ANY app you can open as an object, because the code inside IE.au3 for _IECreateEmbedded() is just:

Func _IECreateEmbedded()
    Local $o_object = ObjCreate("Shell.Explorer.2")
    ; ...error handling snipped
    SetError($_IEStatus_Success)
    Return $o_object
EndFunc   ;==>_IECreateEmbedded

:whistle:

Though, Not every program is an object, With his script, you could run ANY executable. :3

It was like, Running it like normal, except, it was inside the gui, You couldnt move the window out of the gui

and the program didnt show in the task bar.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't believe I've seen that script before, but I have my own version that I made a while ago.

Local $hWndMain = GUICreate("Example")
GUISetState(@SW_SHOW, $hWndMain)
GUIRegisterMsg(0xF, "WM_PAINT")

Local $hWndChild = WinGetHandle("Untitled - Notepad")
DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hWndChild, "hwnd", $hWndMain)
DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hWndChild, "int", -20, "long", 0x80000000+0x40000000+0x40000)
WinSetState($hWndChild, "", @SW_MAXIMIZE)

Do
    Sleep(100)
    Local $Msg = GUIGetMsg()
Until $Msg = -3

Func WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    Sleep(100)
    DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $hWnd, "ptr", 0, "int", 0)
EndFunc
Edited by Emperor

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hmm, All that did, was a maximized GUI.

EDIT::

Nevermind.

But, I would still prefer the other one xP

This one, I dont like. When I move the window, It leaves lines everywhere.

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I've edited my above post, it should fix the "line" problem, but at the expense of a little flickering. I'm sure there is a better way to fix it, but I can't think of one right now.

Share this post


Link to post
Share on other sites

I've edited my above post, it should fix the "line" problem, but at the expense of a little flickering. I'm sure there is a better way to fix it, but I can't think of one right now.

Cool! I like that. Couldn't resist tweaking it just enough to make a practical demo (make sure notepad is available):

Local $hWndMain = GUICreate("Example", 600, 400)
GUISetState(@SW_SHOW, $hWndMain)
GUIRegisterMsg(0xF, "WM_PAINT")

If Not WinExists("Untitled - Notepad") Then Run("notepad.exe")
WinWait("Untitled - Notepad")
Local $hWndChild = WinGetHandle("Untitled - Notepad")
DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hWndChild, "hwnd", $hWndMain)
DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hWndChild, "int", -20, "long", 0x80000000 + 0x40000000 + 0x40000)
WinSetState($hWndChild, "", @SW_MAXIMIZE)

Do
    Sleep(100)
    Local $Msg = GUIGetMsg()
Until $Msg = -3

Func WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    Sleep(100)
    DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $hWnd, "ptr", 0, "int", 0)
EndFunc   ;==>WM_PAINT

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Wow thats pretty cool... now just get the windows called by notepad to only open inside the gui window too.... good luck

Share this post


Link to post
Share on other sites

Mmm, Still gonna wait for the other one xD


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

please post it when you find it...

Also, please post to Auotit Snippets (SEE MY SIG)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I fixed the line flickering, If anyones interested :3

#include <GUIConstants.au3>
Local $hWndMain = GUICreate("Example", 500, 500, -1, -1, $WS_CLIPCHILDREN) ;Seemed to fix the flickering ;3
GUISetState(@SW_SHOW, $hWndMain)

Local $hWndChild = WinGetHandle("Untitled - Notepad")
DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hWndChild, "hwnd", $hWndMain)
DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hWndChild, "int", -20, "long", 0x80000000+0x40000000+0x40000)
WinSetState($hWndChild, "", @SW_MAXIMIZE)

Do
    Sleep(100)
    Local $Msg = GUIGetMsg()
Until $Msg = -3
Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Could someone make it so that this would work inside of a tab?

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