tags:

views:

95

answers:

2

Hi guys, I have a simple QT application running on Win32 platform. I need to write a C++ program described as: the input is the windows handle of that QT application, which is already available, the output is the text name ( AKA caption ) of the application. I hope someone will show me the way to do this right. Thanks a lot. Smile

A: 

I don't know if I completely understand your question, but you could simply use the GetWindowText function (part of the Windows API) to obtain the title of a window. You must of course pass a native window handle (HWND) to this function, QWidget::winID() is the Qt way to retrieve it.

Greg S
A: 

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 the windowTitle().

akira