GZE Posted July 14, 2005 Share Posted July 14, 2005 Hello, I need to retrieve the class of a window to use it in my script. What is the easiest way accomplish this? You could offcourse use the AU3Info.exe and write a routine to filter out the class but I am hoping there is a more direct way. Ex. For a explorer window I would need ExploreWClass. (see below for AU3info.exe) Kind regards GZE Press CTRL-ALT-F to pause the display. >>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: C:\ Class: ExploreWClass Size: X: -4 Y: -4 W: 1928 H: 1155 >>>>>>>>>>> Mouse Details <<<<<<<<<<< Screen: X: 962 Y: 175 Cursor ID: 5 >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0xD4D0C8 Dec: 13947080 >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: X: 589 Y: 76 W: 1329 H: 1030 Control ID: 1 ClassNameNN: SysListView321 Text: >>>>>>>>>>> Status Bar Text <<<<<<<<<<< (1): 59 object(s) (plus 3 hidden) (Disk free space: 8,67 GB) (2): 992 KB (3): My Computer >>>>>>>>>>> Visible Window Text <<<<<<<<<<< C:\ C:\ 59 object(s) (plus 3 hidden) (Disk free space: 8,67 GB) >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< Link to comment Share on other sites More sharing options...
GaryFrost Posted July 14, 2005 Share Posted July 14, 2005 Might try:From help file:WinGetClassList --------------------------------------------------------------------------------Retrieves the classes from a window.WinGetClassList ( "title" [, "text"]) Parameterstitle The title of the window to read. text [optional] The text of the window to read. Return ValueSuccess: Returns a string containing the window classes read. Failure: Returns numeric 1 and sets @error to 1 if no window matches the criteria. RemarksClass names are linefeed (@LF) separated. WinGetClassList works on both minimized and hidden windows. Up to 64KB of text can be retrieved. If multiple windows match the criteria, the classes are read from the most recently active window. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GZE Posted July 14, 2005 Author Share Posted July 14, 2005 Might try:From help file:<{POST_SNAPBACK}>I already found that comand but it does not give the wanted result.These are the values it returns:SciTEWindowContentScintillaScintillaToolbarWindow32SysTabControl32msctls_statusbar32And there is not sign of "ExploreWClass"So please try again Link to comment Share on other sites More sharing options...
LxP Posted July 14, 2005 Share Posted July 14, 2005 (edited) Class names of a window do not change, so is there a particular reason why you need to obtain a class name programmatically? Edited October 22, 2005 by LxP Link to comment Share on other sites More sharing options...
GZE Posted July 14, 2005 Author Share Posted July 14, 2005 (edited) Class names of a window do not change, so is there a particular reason why you need to obtain a class name programatically?<{POST_SNAPBACK}>That is just the reason i would like to use them.eg. Use winlist() and BitAND() to get al your visible windows and close them if they are explorer windows or Internet explorer windows.it's like sometimes you have like 10 of those bastards open and you would like to close them all at once .Class is just a handy way of identifying them.GrtzGZE Edited July 14, 2005 by GZE Link to comment Share on other sites More sharing options...
GaryFrost Posted July 14, 2005 Share Posted July 14, 2005 why don't you just use ProcessList? returns the Process Name and Process ID's into an array. Then you could loop through the array and kill all process of certain type name. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
seandisanti Posted July 14, 2005 Share Posted July 14, 2005 That is just the reason i would like to use them.eg. Use winlist() and BitAND() to get al your visible windows and close them if they are explorer windows or Internet explorer windows.it's like sometimes you have like 10 of those bastards open and you would like to close them all at once .Class is just a handy way of identifying them.GrtzGZE<{POST_SNAPBACK}>seems like if windows or internet explorer, you could identify them by the title of the window since they both have some static text to match. also, if you kill the iexplore process, i believe that gets rid of all open internet explorer windows. Link to comment Share on other sites More sharing options...
LxP Posted July 14, 2005 Share Posted July 14, 2005 eg. Use winlist() and BitAND() to get al your visible windows and close them if they are explorer windows or Internet explorer windows.it's like sometimes you have like 10 of those bastards open and you would like to close them all at once .<{POST_SNAPBACK}>I haven't tried this but I imagine it would work:; allow searching of windows by class name opt("winTitleMatchMode", 4) while (winExists("classname=ExploreWClass")) winClose("last") wEnd while (winExists("classname=AnotherClass")) winClose("last") wEnd Link to comment Share on other sites More sharing options...
buzz44 Posted July 15, 2005 Share Posted July 15, 2005 (edited) Func WinGetClassName($Hwnd) Local $Ret = DllCall("user32.dll", "int", "GetClassName", "hwnd", $Hwnd, "str", "", "int", 64) If Not @Error Then Return $Ret[2] EndFunc Edited July 15, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
GZE Posted July 15, 2005 Author Share Posted July 15, 2005 Func WinGetClassName($Hwnd) Local $Ret = DllCall("user32.dll", "int", "GetClassName", "hwnd", $Hwnd, "str", "", "int", 64) If Not @Error Then Return $Ret[2] EndFunc<{POST_SNAPBACK}> That i didn't think about that one... Thnx 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