[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Finding name/type of CWnd object

Posted on 2009-02-19
Medium Priority
Last Modified: 2013-11-20
I am getting a CWnd * using GetActiveWindow().

I want to forward a message to this CWnd * if it is a certain type of dialog.

How can I go about ascertaining the type/name etc of the CWnd * so I can conditionally post a message to it?

Many thanks for any suggestions.
Question by:Attack_Trax
LVL 19

Accepted Solution

alb66 earned 400 total points
ID: 23682290
First way: use the class type:

CWnd* pWnd = GetActiveWindow();

if ( pWnd->IsKindOf( RUNTIME_CLASS( CYourClass )))
   ... do something

Second way: use the title

CWnd* pWnd = GetActiveWindow();

Cstring strTitle;
pWnd->GetWindowText( strTitle )

if ( strTitle == "Your title" )
   ... do something

Author Comment

ID: 23682937
I had to use IsKindOf() as the Window Text is being used to display status (its a pocket pc app).


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question