DarkBoost Posted April 9, 2011 Share Posted April 9, 2011 Hi... looking for a quick solution, how can I get the RegisterMsg function to initiate when the Calculator moves? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Process.au3> Global $title = "child" Global $exe = "calc.exe" Global $width = 200 Global $height = 200 ShellExecute($exe) ProcessWait($exe) GUICreate($title, $width, $height) GUISetState() GUIRegisterMsg($WM_MOVE, "_move") While 1 Dim $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE If ProcessExists($exe) Then ProcessClose($exe) Exit EndSelect WEnd Func _move() Local $wintitle = WinGetTitle("[CLASS:CalcFrame]", "") Local $winpos = WinGetPos($wintitle) WinMove($title, "", $winpos[0] + $winpos[2], $winpos[1], $width, $winpos[3]) EndFunc ;=> Function: reposition child window Link to comment Share on other sites More sharing options...
UEZ Posted April 9, 2011 Share Posted April 9, 2011 (edited) Try this way: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Process.au3> Global $title = "child" Global $exe = "calc.exe" Global $width = 200 Global $height = 200 Global $msg $run = Run($exe) ProcessWait($run) GUICreate($title, $width, $height) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE If ProcessExists($exe) Then ProcessClose($exe) GUIDelete() Exit EndSelect If Not ProcessExists($exe) Then Exit GUIDelete() $wintitle = WinGetTitle("[CLASS:CalcFrame]", "") $winpos = WinGetPos($wintitle) WinMove($title, "", $winpos[0] + $winpos[2], $winpos[1], $width, $winpos[3]) WEnd Br, UEZ Edited April 9, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
DarkBoost Posted April 9, 2011 Author Share Posted April 9, 2011 this works well, thanks for the quick response! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now