kantaki Posted January 11, 2012 Share Posted January 11, 2012 Hello, i have a big problem with winsetstate, it doesnt work safe with some programs. if i use my program => $WinList = WinList("[CLASS:#32770]") it permantly closes all windows and my screen begins to flicker. if i use it with $WinList = WinList("[CLASS:Notepad]") everything is fine. do you have an idea how i can make the winsetstate safer ? or do you have an alternative that might work for me ? #include <WinAPI.au3> Global $WinList, $WinGetPos, $hLast, $Pos1, $Pos2, $Pos3, $Pos4, $Pos5 Global $Struct = DllStructCreate($tagPoint) Func Refresh() $WinList = WinList("[CLASS:#32770]") EndFunc Func StartUp() Refresh() For $i = 1 To $WinList[0][0] WinSetState($WinList[$i][0],"",@SW_MINIMIZE) Next EndFunc while 1 sleep(2000) StartUp() WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2012 Moderators Share Posted January 11, 2012 kantaki,When I run WinList("[CLASS:#32770]") on my machine all I get are the available (but hidden) dialogs from the apps I have in the system tray - why on earth would I want to minimize them every 2 secs? What exactly are you trying to do? If you explain we might be able to help, but at the moment there is little clue in that code. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kantaki Posted January 11, 2012 Author Share Posted January 11, 2012 (edited) kantaki, When I run WinList("[CLASS:#32770]") on my machine all I get are the available (but hidden) dialogs from the apps I have in the system tray - why on earth would I want to minimize them every 2 secs? What exactly are you trying to do? If you explain we might be able to help, but at the moment there is little clue in that code. M23 hey thank you for the fast answer. its a window arranger. i have a main window and 10 subwindows. i want to filter the windows based on a visible button class. i implelemted this in csharp with autoitX. if the button is visible => maximize the window if not minimize them. i got it all ready but i still have big problems with the minimize function, because it permanently minimizes all applications on my computer. autoit window info tells me that the main class is #32770 and the button class AfxWnd90u22 if i only run the WinList("[CLASS:#32770]") the output of my $WinList[0][0] is 0. ( without any open applications ) but the main application has a lot of different windows (like sliders etc) with the same name as the mainclass but with a instance number for example the main class is #32770 but some buttons have a basic control info => #327702 ( 2 is the instance ) maybe thats causing problems ? ----------------------------------- i dont know if this helps but i could post my csharp code. expandcollapse popupusing System; using System.Collections.Generic; using System.Linq; using System.Text; using AutoItX3Lib; using System.Collections; using System.Runtime.InteropServices; namespace pokerautoit { class WindowControl { AutoItX3 au3 = new AutoItX3(); public List<string> windowPos = new List<string>(); public dynamic[,] winlist; public WindowControl() { winlist = au3.WinList("[CLASS:#32770]"); windowPos.Add(""); windowPos.Add(""); windowPos.Add(""); windowPos.Add(""); windowPos.Add(""); windowPos.Add(""); } public Boolean isMinimized(string title) { if ((this.au3.WinGetPosX(title, "")) == -32000) { return true; } return false; } public Boolean isButtonVisible(string title) { dynamic button = au3.ControlCommand(title, "", "AfxWnd90u21", "IsVisible", ""); if (button == "1") { return true; } return false; } public void winMove(string title,int i) { if (this.isButtonVisible(this.winlist[0, i]) == true) { if (this.isMinimized(title) == true) { this.winMax(title); } if (windowPos[0]=="" && 1 <= this.sizeOfButton() && !(windowPos.Contains(title))) { au3.WinMove(title, "", 0, 0, 640, 463); windowPos[0] = title; } else if (windowPos[1] == "" && 2 <= this.sizeOfButton() && !(windowPos.Contains(title))) { au3.WinMove(title, "", 640, 0, 640, 463); windowPos[1] = title; } else if (windowPos[2] == "" && 3 <= this.sizeOfButton() && !(windowPos.Contains(title))) { au3.WinMove(title, "", 1280, 0, 640, 463); windowPos[2] = title; } else if (windowPos[3] == "" && 4 <= this.sizeOfButton() && !(windowPos.Contains(title))) { au3.WinMove(title, "", 0, 463, 640, 463); windowPos[3] = title; } else if (windowPos[4] == "" && 5 <= this.sizeOfButton() && !(windowPos.Contains(title))) { au3.WinMove(title, "", 640, 463, 640, 463); windowPos[4] = title; } else if (windowPos[5] == "" && 6 <= this.sizeOfButton() && !(windowPos.Contains(title))) { au3.WinMove(title, "", 1280, 463, 640, 463); windowPos[5] = title; } } } public void winMax(string title) { au3.WinSetState(title, "", 1); } public void winMin(string title) { if (this.isButtonVisible(title) == false) { if (this.isMinimized(title) == false) { if (windowPos.Contains(title)) { windowPos[windowPos.IndexOf(title)] = ""; } au3.WinSetState(title, "", 6); } } } public int size() { return this.winlist[0, 0]; } public int sizeOfButton() { int count = 0; for (int i = 1; i <= this.size(); ++i) { if (this.isButtonVisible(this.winlist[0, i]) == true) ++count; } return count; } } } Edited January 11, 2012 by kantaki 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