Pywin32 - how to access the data that a "data handle" refers to

855 Views Asked by At

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!

0

There are 0 best solutions below