1

I'm trying to gather information about some child windows in a Windows application (written in Visual Studio using C++). I'm using pywinauto and pywin32.

In a very small python script, I thought I would get good information using win32gui.EnumPropsEx. There is less information returned than I hoped, and one of the items returned is supposed to be a "handle to the property data". Once I have the "handle", how do I access the property data?

Here's the code:

import win32gui

def propfunc(hwnd, prop, x, y):
    print("\nProperty for %d is %s\n" %(hwnd, prop))
    print("x is %d, and y is %s\n" %(x, y))
    return 1

def main():
    handleList = (1574574, 722384, 1311872, 1967920, 2295590)
    for hwnd in handleList:
        print("For hwnd %d:" %hwnd)
        win32gui.EnumPropsEx(hwnd, propfunc, None)
        print("\n\n\n")

main()

And here's a(n edited) snippet of the result I get:

For hwnd 1574574:

Property for 1574574 is fpTextTip

x is 2621596, and y is None

Property for 1574574 is 43288

x is -1, and y is None

I'm thinking the 2621596 is the "handle to the property data" that I was told to expect. I have no clue about how to retrieve that property data, and msdn has not been helpful. Anyone care to tell me how one gets from a data handle to the data?

Thanks!

mired
  • 51
  • 1
  • 1
  • 4
  • What's wrong with pywinauto? `app.window(handle=hwnd, top_level_only=False).wrapper_object()` In what form do you expect the property data? Which properties do you expect to see? – Vasily Ryabov May 23 '18 at 15:14
  • Vasily Ryabov - I haven't figured out how to get any information about the contents of these child windows -- the spreadsheets I had foolishly hoped to find some way to access. Didn't expect to find anything of real value in these properties; just grasping at straws. Since neither pywinauto nor pywin32 (just a 'wrapper' around Windows functions, right?) recognizes any other 'children' of these spreadsheet (child) windows -- where I had hoped to find references to the contained cells -- I am at a loss how to proceed. Some cells respond to input and clicks. Windows must know about them!! – mired May 23 '18 at 22:50
  • First you need to try Spy++ and Inspect.exe (they are mentioned in [this guide](https://pywinauto.readthedocs.io/en/latest/getting_started.html) with download links). If Inspect.exe can't see the UI elements, then it's time to give up. Not earlier. – Vasily Ryabov May 24 '18 at 14:15
  • 1
    Vasily Ryabov - Yeah, Inspect.exe and Spy++ did not provide any additional information: How found: Mouse move (1391,188) hwnd=0x00090A6A 32bit class="SPR32AU80_SpreadSheet" ChildId: 0 Interfaces: IEnumVARIANT IOleWindow IAccIdentity Impl: Remote oleacc proxy ... ChildCount: 2 Window: 0x90A6A FirstChild: [null] LastChild: [null] Next: [null] Previous: [null] ... Other Props: Object has no additional properties Children: none : window : invisible,focusable none : window : invisible,focusable Ancestors: "Mode: " : window : focusable "" : dialog : focusable ... – mired May 24 '18 at 17:29

0 Answers0