Windows

Obtaining the title of another application

core7ms 2017. 1. 25. 16:43

It's very easy to get pointer of CWnd instance.

Just use CWnd::FindWindow function.

and we can find the title using GetWindowText member function

 

This is an example code to get a title of VLC player.

The class of VLC player is 'QWidget'

 

 

CString str;

CWnd* pWnd = CWnd::FindWindow(_T("QWidget"), 0);

if (pWnd)

{

pWnd->GetWindowText(str);

}

 

if (str.Find(_T("VLC")) >= 0)

{

MessageBox(str);

}