E1M1 Posted June 23, 2011 Share Posted June 23, 2011 (edited) If I capture window GUICtrlSetTip causes problems when I let this window go behind other windows or if I minimize it. By capture I mean that I pick window that belongs to other process than @AutoItPID and make that child window of my autoit's window. When I later minimize window and then restore it. All WinGetState tests show that window is active, but actually it is not drawn. When you run this code below. It first creates window, then runs notepad and makes notepad's window child window. After that play with this window. Click on notepad window inside to give it focus after then minimize and restore main window by clicking on it's title on _taskbar_ (note that when you click on minimize button main window will get focus and bug doesnt happen. Other thin you can try is 1) click on notepad window inside Autoit's window. and then click on scite's window so that it would cover autoit's window. Then try bring autoit's window in front by using taskbar. Note: when you uncomment GUICtrlSetTip(-1, "New") and try then again you wont have that problem. Important1: It happens when you click on childwindow (so child would get focus and parent will loose it) before you minimize it or kill it's focus. This problem never happens if Parent window has focus when you minimize it or let it go behind other windows. Important2: It only happens when you have GUICtrlSetTip after GUICtrlCreateButton, AND never happens if you comment this out. Note: Doesn't happen if you use GUI create to create child window. to say it all short: take code below and try minimizing, and restoring this window by clicking it's child windot at frst and then on it's title on taskbar. Dont touch minimize button on autoit's parent GUI Does anyone know what causes such problem and how to fix it with out uncommenting GUICtrlSetTip(-1, "New")? If there's anything I didn't explain well enough please let me know. Edit: other thing to play with while this script is running: ALT + TAB window switching. Problematic code. expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GuiButton.au3> #include <SendMessage.au3> #include <Constants.au3> ;====================MAIN WINDOW START========================= $GUI = GUICreate("Parent", 700, 600) $add = GUICtrlCreateButton("new", 0, 0, 30, 25, BitOR($BS_ICON, $WS_GROUP)) GUICtrlSetTip(-1, "New") GUISetState(@SW_SHOW, $GUI) GUIRegisterMsg(0x0006, "ClickHandler") $proc = Run("notepad") WinWaitActive("[CLASS:Notepad]") $hWnd = WinGetHandle("[CLASS:Notepad]") capture($hWnd) ;========================================= ;~~~~~~~~~~~~~~~~~MAIN LOOP~~~~~~~~~~~~~~~ ;========================================= While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func capture($hWnd) ConsoleWrite("Debug: hWnd = '" & $hWnd & "'" & @CRLF) If $hWnd <> "" Then _WinAPI_SetParent($hWnd, $GUI) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, $WS_EX_MDICHILD) _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE) ConsoleWrite($hWnd & ".Parent = " & $GUI & @CRLF) ConsoleWrite($hWnd & ".Style = WS_EX_MDICHILD" & @CRLF) ConsoleWrite($hWnd & ".ExStyle = WS_POPUP + WS_VISIBLE" & @CRLF) WinMove($hWnd, "", 0, 26, 700, 600) EndIf EndFunc ;==>capture Func ClickHandler($hWnd, $Msg, $wParam, $lParam) If $hWnd = $GUI Then ConsoleWrite("MAIN GUI RECEIVED WM_ACTIVATE:" & @CRLF) ConsoleWrite(" Is Visible? = " & WinCheckState($hWnd, 2) & @CRLF) ConsoleWrite(" Is Active? = " & WinCheckState($hWnd, 8) & @CRLF) ConsoleWrite(" Is Enabled? = " & WinCheckState($hWnd, 4) & @CRLF) ConsoleWrite(" active window = " & WinGetTitle("[ACTIVE]") & @CRLF) EndIf _SendMessage($GUI, 0x0006) EndFunc ;==>ClickHandler Func WinCheckState($handle, $iState) If BitAND(WinGetState($handle), $iState) Then Return True Else Return False EndIf EndFunc ;==>WinCheckState Edited June 26, 2011 by E1M1 edited Link to comment Share on other sites More sharing options...
E1M1 Posted June 24, 2011 Author Share Posted June 24, 2011 bump. edited Link to comment Share on other sites More sharing options...
E1M1 Posted June 26, 2011 Author Share Posted June 26, 2011 I hate to say it but bump. edited Link to comment Share on other sites More sharing options...
JohnOne Posted June 26, 2011 Share Posted June 26, 2011 Maybe all the "Pro MVPs" are too busy right now. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
monoscout999 Posted June 26, 2011 Share Posted June 26, 2011 (edited) i think that are a message problem. If i add this to the main loop...While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit case $GUI_EVENT_RESTORE WinActivate($hWnd) EndSwitch WEnd...the notepad child window dont have any problem, but the main GUI still restore behind other windows...Two tips.1 don´t use the same name for global variables and function parameters, that is confusing and i don´t know what is the autoit behavior when this happend...2 I´m not a MVPs, but i am the only one who answer this thread.... so be nice i stop asking for MVPs only because this is an open forum and ALL can bennefic with knowldege from this thread.EDIT: mmmmh wotks some times and some times no... :S Edited June 26, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
E1M1 Posted June 26, 2011 Author Share Posted June 26, 2011 (edited) Thanks you. This was actually to get someone look into it because no one looked it. Maybe one day you will be MVP. Also Topic title doesn't include word only which means it's good challenge for MVPs but it doesn't say that say that you may not post here. Sorry if it looked like filtering to you. I wasn't trying to filter anyone out. Would you have looked into this topic with out that prefix? Edited June 26, 2011 by E1M1 edited Link to comment Share on other sites More sharing options...
JohnOne Posted June 26, 2011 Share Posted June 26, 2011 I personally skipped your thread until I seen you bumped it a couple of times, because you specified MVPs. Unfortunately I'm no help anyway because I've never used Registermessage or used child windows and sucklike, but I can offer a couple of posting tips. Specifying you want only MVPs (I dont know what MVP stands for, for expect its something to do with experienced proven scripters as well as other attributes) probably isnt the best way to do things. It falls under the categary of trying to make your problem seem more important than another, akin to writing URGENT or all caps lock, and I would be surprised if an MVP would respond to it for such a reason. The people who like to help others here will read the threads and help if they can without bias when they are properly written, their is no need to try to make it more visible, if it dosent get answered as quickly as another, its most likely because a person who can help has not read it, or had the time to respond yet, so the normal bump after 24 hours is the way to go adding any further efforts you have tried. Hope this helps for the future. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
E1M1 Posted June 26, 2011 Author Share Posted June 26, 2011 Thanks JohnOne. I'll say again it wasnt meant "MVP only" or anything like that it was more like.,.,. cant explain it well... I pretty much followed 24 hour bump rule. My apologies for everyone who felt bad about this in any way. edited Link to comment Share on other sites More sharing options...
UEZ Posted June 26, 2011 Share Posted June 26, 2011 I don't know the reason for that particular behaviour but here a workaround: expandcollapse popup#include <ButtonConstants.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <SendMessage.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ;====================MAIN WINDOW START========================= $GUI = GUICreate("Parent", 700, 600) $add = GUICtrlCreateButton("new", 0, 0, 30, 25, BitOR($BS_ICON, $WS_GROUP)) GUICtrlSetTip($add, "New") GUIRegisterMsg(0x0006, "ClickHandler") $proc = Run("notepad") WinWaitActive("[CLASS:Notepad]") $hWnd = WinGetHandle("[CLASS:Notepad]") capture($hWnd) GUISetState(@SW_SHOW, $hWnd) GUISetState(@SW_SHOW, $GUI) ;========================================= ;~~~~~~~~~~~~~~~~~MAIN LOOP~~~~~~~~~~~~~~~ ;========================================= GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetOnEvent($GUI_EVENT_RESTORE, "Wnd_Restore") ControlFocus($GUI, "", 15) While Sleep(1000) WEnd Func Wnd_Restore() WinSetOnTop($GUI, "", 1) ControlFocus($GUI, "", 15) WinSetOnTop($GUI, "", 0) EndFunc Func _Exit() Exit EndFunc Func capture($hWnd) ConsoleWrite("Debug: hWnd = '" & $hWnd & "'" & @CRLF) If $hWnd <> "" Then _WinAPI_SetParent($hWnd, $GUI) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, $WS_EX_MDICHILD) _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE) ConsoleWrite($hWnd & ".Parent = " & $GUI & @CRLF) ConsoleWrite($hWnd & ".Style = WS_EX_MDICHILD" & @CRLF) ConsoleWrite($hWnd & ".ExStyle = WS_POPUP + WS_VISIBLE" & @CRLF) WinMove($hWnd, "", 0, 26, 700, 600) EndIf EndFunc ;==>capture Func ClickHandler($hWnd, $Msg, $wParam, $lParam) If $hWnd = $GUI Then ConsoleWrite("MAIN GUI RECEIVED WM_ACTIVATE:" & @CRLF) ConsoleWrite(" Is Visible? = " & WinCheckState($hWnd, 2) & @CRLF) ConsoleWrite(" Is Active? = " & WinCheckState($hWnd, 8) & @CRLF) ConsoleWrite(" Is Enabled? = " & WinCheckState($hWnd, 4) & @CRLF) ConsoleWrite(" active window = " & WinGetTitle("[ACTIVE]") & @CRLF) EndIf _SendMessage($GUI, 0x0006) EndFunc ;==>ClickHandler Func WinCheckState($handle, $iState) If BitAND(WinGetState($handle), $iState) Then Return True Else Return False EndIf EndFunc ;==>WinCheckState Br, 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...
E1M1 Posted June 26, 2011 Author Share Posted June 26, 2011 Thanks, nice workaround. Does removing GUICtrlSetTip(-1, "New") fix this problem for you too? Just want to be sure that GUICtrlSetTip(-1, "New") is what causes problem. In this case it might have something to do with IE. As I understood from help it relies on IE. in this case IE may be buggy or autoit may be buggy or code may be buggy. edited Link to comment Share on other sites More sharing options...
UEZ Posted June 26, 2011 Share Posted June 26, 2011 No, it is not removed! Look to line 13 -> GUICtrlSetTip($add, "New") While I moved that line around I added $add instead of -1. Br, 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...
E1M1 Posted June 26, 2011 Author Share Posted June 26, 2011 (edited) I didn't ask this but thanks. I just wanted to know if you use original code (code from first post) but comment GUICtrlSetTip out, then do you still have this issue? I wanted to know if not having GUICtrlSetTip in originally posted code fixes problem for you. Edited June 26, 2011 by E1M1 edited Link to comment Share on other sites More sharing options...
UEZ Posted June 26, 2011 Share Posted June 26, 2011 Yes, I was able to reproduce the problem with GUICtrlSetTip(). Br, 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...
E1M1 Posted June 26, 2011 Author Share Posted June 26, 2011 in this case shall it be reported as bug, since it's GUICtrlSetTip that causes it? what calls are made by GUICtrlSetTip? Is there any function in some DLL for this? or is it sequence of calls? edited 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