Jump to content

Run a program inside a GUI?


Gui
 Share

Recommended Posts

Not unless you can figure out how to run it as an embedded object and I doubt that is possible with Calc. Someone else may have an idea but I don't think so.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Try this example :mellow:

#Include <WinAPI.au3>

; create the AutoIt Gui
$hWndParent = GUICreate('AutoIt Gui')
GUISetState()

; run Calc
Run('calc')
Sleep(500)
WinWait('Calc')

; get the handle of the Calc window
$hWndChild = WinGetHandle('Calc')

; set child (Calc) to parent (AutoIt Gui)
_WinAPI_SetParent($hWndChild, $hWndParent)

While GUIGetMsg() <> -3
WEnd

Perhaps gives you something to work with.

Link to comment
Share on other sites

Try this example :mellow:

#Include <WinAPI.au3>

; create the AutoIt Gui
$hWndParent = GUICreate('AutoIt Gui')
GUISetState()

; run Calc
Run('calc')
Sleep(500)
WinWait('Calc')

; get the handle of the Calc window
$hWndChild = WinGetHandle('Calc')

; set child (Calc) to parent (AutoIt Gui)
_WinAPI_SetParent($hWndChild, $hWndParent)

While GUIGetMsg() <> -3
WEnd

Perhaps gives you something to work with.

Whenever I have used that method I get 2 problems. :(

The first is that the child is not redrawn correctly, so I solve that by adding the style $WS_CLIPCHILDREN to the parent.

The second problem is that when the parent is dragged, Windows seems to loose track of where the child is and you can no longer drag the child if you move the parent far enough. (If the new position for the child caption overlaps the previous position then you can drag the child if you click in the overlapping area.)

So I solve that by moving the child twice, ie away and back, and then Window's 'memory' of the child position seems to get refreshed.

If there is a better way I would like to be told. (I possibly have been told and forgot though.)

#Include <WinAPI.au3>
#include <constants.au3>
#include <windowsconstants.au3>
#include <guiconstantsEx.au3>

; create the AutoIt Gui
$hWndParent = GUICreate('AutoIt Gui')
GUISetState()

; run Calc
Run('calc')
Sleep(500)
WinWait('Calc')

; get the handle of the Calc window
$hWndChild = WinGetHandle('Calc')

; set child (Calc) to parent (AutoIt Gui)
;first set the style for the parent
$style = _WinAPI_GetWindowLong($hWndParent,$GWL_STYLE)
$style = BitOr($style,$WS_CLIPCHILDREN)
_WinAPI_SetWindowLong($hWndParent,$GWL_STYLE,$style)
_WinAPI_SetParent($hWndChild, $hWndParent)

Global Const $WM_EXITSIZEMOVE = 0x0232
GUIRegisterMsg($WM_EXITSIZEMOVE,"WMEXITMOVE")
Global $calpos
While GUIGetMsg() <> -3

WEnd


Func wmexitmove($h, $m,$w,$l)
    Local $calcpos = wingetpos($hWndChild)
    Local $rp = dllstructcreate("int;int")
    dllstructsetdata($rp,1,$calcpos[0])
    dllstructsetdata($rp,2,$calcpos[1])
    _WinAPI_ScreenToClient($hWndParent,$rp)
    winmove($hWndChild,"",dllstructgetdata($rp,1)+1,dllstructgetdata($rp,2));away
    winmove($hWndChild,"",dllstructgetdata($rp,1),dllstructgetdata($rp,2));back
    return $GUI_RUNDEFMSG

EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I read it that he wants another app (probably not Calc) embedded in an AutoIt GUI. If he's trying to do that so he can skin the app then a simple search of Example scripts would have lead him here.

http://www.autoitscript.com/forum/index.php?showtopic=32494&view=findpost&p=233842

The problem with this type of post is they try to use generalities to hide what they are really attempting to do and then we have to polish our crystal balls to figure it out.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Wow i'm dumb, forgot to subscribe to the thread. No wonder I got no warnings! Ah, so guys thanks all for your help , but Windows Calculator was an example.

I'm talking about literally running a program in a GUI. The original idea was that you would a program in a GUI, let's say Windows Calculator. Everything the same, except it's litterally inside the GUI, put there. ( So to speak, the calculators GUI is now your AutoIt GUI.) Hopefully, that's a little more clear. Then, you'd make a sort of mouse icon that moved, but didn't control your actually computer mouse. Then that mouse would carry out functions, clicking, etc.

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...