Connect a QT application using C ++ to capture the text name of the application

I have a simple QT application running on a Win32 platform. I need to write a C ++ program described as: input is the window handle of this QT application, which is already available, output is the text name (AKA signature) of the application. Hope someone shows me how to do it right. Many thanks. Smile

+3
source share
2 answers

I don’t know if I fully understand your question, but you can simply use the function GetWindowText (part of the Windows API) to get the window title. Of course, for this function you need to pass your own window handle ( HWND), QWidget::winID()this is the Qt way to get it.

+1
source

http://doc.trolltech.com/4.6/qwidget.html#windowTitle-prop

This property holds the window title (caption).

This property only makes sense for top-level widgets, such as windows
and dialogs. If no caption has been set, the title is based of the 
windowFilePath. If neither of these is set, then the title is an empty string.

so just ask the QMainWindow you are using about windowTitle().

0
source

Source: https://habr.com/ru/post/1755248/


All Articles