Get text from popup window

前端 未结 2 992
谎友^
谎友^ 2020-12-28 22:28

I\'m trying to read the text from a popup window.

\"errors\"

The title is always the same. I\'ve man

相关标签:
2条回答
  • 2020-12-28 22:51

    I don't have access to the framework or the error dialog you are using, so I can only say in general what you want.

    You need the FindWindowEx function, and use it to find a control whose class name is 'static' (or whatever the class name of the control is). I imagine this would be the line:

    control = win32gui.FindWindowEx(window, 0, "Static", 0)
    

    That returns the handle to the control, and you can then use GetWindowText on that to get the text.

    0 讨论(0)
  • 2020-12-28 23:01

    You will only be able to read this text programmatically if it is contained in a windowed control. You can easily check this with Spy++. Many GUI frameworks don't use windowed controls for their child controls, or only use windowed controls for some children.

    If it is a windowed control then you can identify it by calling GetWindow() and walking the child structure (obviously you need to use the win32gui equivalent).

    0 讨论(0)
提交回复
热议问题