find discount viagra online

Friday, August 22, 2014

How to get open Windows in MFC

November 5, 2009 by · Leave a Comment 

Hi, i have very little experience in MFC and VC++. I was developing a small project, during development i need to view the list of all opened windows in my explorer. i read somewhere and like to post the solution of this only for you :-)

It is very simple. here is the example by which you can display titles of each window opened. try this and enjoy.
In your OnInitDialog() write this…

HWND hnd = ::GetWindow(::GetDesktopWindow(), GW_CHILD);
CWnd *pWnd;
CString csTitle = "";

while( (hnd != NULL) )
{
pWnd = CWnd::FromHandle(hnd);
pWnd->GetWindowText(csTitle);

MessageBox(csTitle, "Title", NULL);
hnd = *pWnd->GetNextWindow(GW_HWNDNEXT);
}

Top Blogs

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

*