Sign in to follow this  
Followers 0
Xtian

how to run exe file inside a gui?

7 posts in this topic

is it possible to run executable files inside gui?

for example, i want to put the yahoo messenger inside my gui so i dont need to switch tab all the time?

i always have lots of window tabs open when im online so i was just thinking if i can put them and run them all inside 1 window.

sorry if its sounds confusing hope you can understand.

thanks.


Sorry for being noob but... thanks to you im learned something new.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Yes this is possible :D

I found this post from user "eukalyptus" in german autoit forum.

I hope this help you.

http://www.autoit.de/index.php?page=Thread&postID=60950#post60950

This code starts notepad.exe into a autoit gui as a child window.

#include <WindowsConstants.au3>
Opt("TrayIconDebug",1)

$hGui = GUICreate("Test GUI", 320, 240)
GUISetState(@SW_HIDE, $hGui)

$hPid=Run(@SystemDir & 'notepad.exe',"", @SW_HIDE)
WinWait("[CLASS:Notepad]", "", 5)
$hChild = WinGetHandle("[CLASS:Notepad]", "")
$NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hGui)
WinMove($hChild, "", 0, 0,320,240)
GUISetState(@SW_SHOW, $hGui)
WinSetState($hChild,"",@SW_SHOW)

While GUIGetMsg()<>-3
Sleep(1)
WEnd

Func OnAutoItExit()
ProcessClose($hPid)
EndFunc
Edited by Autolaser

Regards Autolaser

Share this post


Link to post
Share on other sites

Yes this is possible :D

I found this post from user "eukalyptus" in german autoit forum.

I hope this help you.

http://www.autoit.de/index.php?page=Thread&postID=60950#post60950

This code starts notepad.exe into a autoit gui as a child window.

#include
Opt("TrayIconDebug",1)

$hGui = GUICreate("Test GUI", 320, 240)
GUISetState(@SW_HIDE, $hGui)

$hPid=Run(@SystemDir & 'notepad.exe',"", @SW_HIDE)
WinWait("[CLASS:Notepad]", "", 5)
$hChild = WinGetHandle("[CLASS:Notepad]", "")
$NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hGui)
WinMove($hChild, "", 0, 0,320,240)
GUISetState(@SW_SHOW, $hGui)
WinSetState($hChild,"",@SW_SHOW)

While GUIGetMsg()<>-3
Sleep(1)
WEnd

Func OnAutoItExit()
ProcessClose($hPid)
EndFunc

You forgot the include...

#include <WindowsConstants.au3>
Opt("TrayIconDebug",1)

$hGui = GUICreate("Test GUI", 320, 240)
GUISetState(@SW_HIDE, $hGui)

$hPid=Run(@SystemDir & 'notepad.exe',"", @SW_HIDE)
WinWait("[CLASS:Notepad]", "", 5)
$hChild = WinGetHandle("[CLASS:Notepad]", "")
$NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hGui)
WinMove($hChild, "", 0, 0,320,240)
GUISetState(@SW_SHOW, $hGui)
WinSetState($hChild,"",@SW_SHOW)

While GUIGetMsg()<>-3
    Sleep(1)
WEnd

Func OnAutoItExit()
    ProcessClose($hPid)
EndFunc

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Share this post


Link to post
Share on other sites

You forgot the include...

hmmm, copy & paste error or magic? :D


Regards Autolaser

Share this post


Link to post
Share on other sites

As usual, AutoIt code tags have been broken. I'll look into it.

Jon, after upgrading the forum.

Thats 10 days ago, not sure if stuff still messed up.


[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Share this post


Link to post
Share on other sites

thanks again for help :D


Sorry for being noob but... thanks to you im learned something new.

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