Toppoint Posted April 13, 2008 Share Posted April 13, 2008 Hello everybody. I hope you can help me. Its only a small problem. I would like to create a special GUI. The window, that i will create should be not active. Example: The script is starting and creates a GUI. Normally the focus is on it and the current window is out of the focus. The label on the bar is grey and not active, because the created GUI of the autoit script (compiled) is on focus after starting. Thats normal. Each program is normally active. But i want to open a window without that focus. You know what i mean ? The old window should be active and not the new opened one from the autoit script (compiled or not compiled is not important) For example: I working with the notepad. I type something ... The script is starting after some time and is opening a window as topmost. (THATS not a problem) But this window is then active and the notepad window is inactive until i click on it. I want the new window of the autoit script as topmost and inactive but visible. I hope you can help me with this small problem. I dont find a solution. I have tried it like that: $hGUI2 = GUICreate("Test", 250, 250, $pos[0], $pos[1], 1, $WS_EX_TOPMOST + $WS_DISABLED + $WS_EX_TOOLWINDOW , $hGUI1) It shows the window as topmost but active. Maybe you can help me. Thank you. (Excuse my english.) Best regards, Toppoint Link to comment Share on other sites More sharing options...
monoceres Posted April 13, 2008 Share Posted April 13, 2008 (edited) This is a possible solution (The created GUI get focus for a couple of ms though) $title=WinGetTitle("") GUICreate("Hello") GUISetState() WinActivate($title) Edit: Fixed syntax error Edited April 14, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 13, 2008 Share Posted April 13, 2008 (edited) When your script runs, the GUI is "built" behind the curtain, so to speak, and is not visible until you do GuiSetState(), which will make it active, as you say. But, GuiSetState() will take parameters for other states, i.e. @SW_SHOWNA $hGUI = GUICreate("Test", 200, 200) $ctrlButton = GUICtrlCreateButton("Close", 50, 150, 100, 30) GUISetState(@SW_SHOWNA) While 1 If GUIGetMsg() = $ctrlButton Then Exit WEnd Edit: Typo in state macro name. Edited April 14, 2008 by PsaltyDS 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 Link to comment Share on other sites More sharing options...
Toppoint Posted April 14, 2008 Author Share Posted April 14, 2008 Hello. Thank you very much for your fast reply. I have tested your examples and i think the best way is the winactivate solution. For example: The notepad window will be activated while the autoit script starts. Its the topmost window and the focus is not on it. Perfect. It works very fine. You are great. regards, Toppoint 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