I'm currently on Python 3 using the Win32 api. For window inspection, I'm using the Microsoft Inspect Tool. Currently, I have the following code that enumerates through all the windows:
def getSelectedFile():
def callback(handle, hwnds):
print(str(handle) + " - class name: " + win32gui.GetClassName(handle) + "-- name: " + win32gui.GetWindowText(handle))
return True
hwnd = win32gui.GetForegroundWindow()
if hwnd:
if win32gui.GetClassName(hwnd) == 'CabinetWClass': # this is the main explorer window
win32gui.EnumChildWindows(hwnd, callback, None)
And this would output the following:
19269320 - class name: BrowserFrameGripperClass-- name:
526990 - class name: WorkerW-- name:
395922 - class name: ReBarWindow32-- name:
13371224 - class name: TravelBand-- name:
2559382 - class name: ToolbarWindow32-- name:
11076870 - class name: Address Band Root-- name:
2230638 - class name: msctls_progress32-- name:
7930970 - class name: Breadcrumb Parent-- name:
6292500 - class name: ToolbarWindow32-- name: Address: LibrariesPictures
8980342 - class name: ToolbarWindow32-- name:
9568934 - class name: UniversalSearchBand-- name:
11403790 - class name: Search Box-- name:
7407762 - class name: SearchEditBoxWrapperClass-- name:
23266054 - class name: DirectUIHWND-- name:
7078564 - class name: ShellTabWindowClass-- name: Pictures
11732514 - class name: DUIViewWndClassName-- name:
12584158 - class name: DirectUIHWND-- name:
1118546 - class name: CtrlNotifySink-- name:
987636 - class name: NamespaceTreeControl-- name: Namespace Tree Control
8193258 - class name: Static-- name: Namespace Tree Control
24314574 - class name: SysTreeView32-- name: Tree View
21103510 - class name: CtrlNotifySink-- name:
1642968 - class name: Shell Preview Extension Host-- name: Shell Preview Extension Host
1577368 - class name: CtrlNotifySink-- name:
2036036 - class name: SHELLDLL_DefView-- name: ShellView
24380214 - class name: DirectUIHWND-- name:
1969552 - class name: CtrlNotifySink-- name:
594366 - class name: ScrollBar-- name:
987466 - class name: CtrlNotifySink-- name:
17827752 - class name: ScrollBar-- name:
2035978 - class name: CtrlNotifySink-- name:
4851916 - class name: Button-- name: Save
13174848 - class name: CtrlNotifySink-- name:
7145486 - class name: Button-- name: Cancel
1509810 - class name: WorkerW-- name:
12781114 - class name: ReBarWindow32-- name:
11405468 - class name: ToolbarWindow32-- name:
1315080 - class name: msctls_statusbar32-- name:
Which is great. But also notice that these objects have a frameworkId of ONLY "Win32" by looking at the Inspect tool (as you can see in the picture).
From the inspector, I noticed that some objects have a different frameworkId named "DirectUI", and they don't seem to show up from the EnumChildWindows function. This is a problem, because the object that contains all the files is actually called "Items View" pane, and it is "DirectUI" (refer to the second picture). So it's not even getting detected. If it's not detected, how can I read all the files inside it? I know that the names are there because you can see them in the tree (in the picture below)
How can I get Win32API to work with DirectUI in order to read the file names?
Is there an easier way of retrieving a list of names of all the files?