Solved

How do I get Class name of CWnd Object ?

Posted on 2000-04-01
3
3,518 Views
Last Modified: 2013-11-20
When an object from another application
is captured, I want to know the objects name.

For example:
Spy++ retirves MSWord Editor class name
as _Wwg.

What is the MFC / API function
that does so ?

Yair


0
Comment
Question by:yairy
  • 2
3 Comments
 
LVL 3

Expert Comment

by:GlennDean
ID: 2676155
Hi yairy:
pWnd->GetRuntimeClass->m_lpszClassName
returns the class name of the object.
   The class does have to use one of the DECLARE_DYNAMIC/DECLARE_SERIAL macros.
   Glenn
0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2676162
DECLARE_DYNCREATE also works.  An example is say I have a class CMyView and in its OnDraw function I write
pDC->TextOut(0,0,GetRuntimeClass->m_lpszClassName);
it spits out
CMyView.
   Glenn  
0
 
LVL 30

Accepted Solution

by:
SteveGTR earned 50 total points
ID: 2676221
This will work:

TCHAR szClassName[255];
if (!::GetClassName(m_hWnd, szClassName, 255))
  ; // Do what you need to do

Good Luck,
Steve
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 113
fizzArray  challenge 1 109
Change to event 1 129
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 1,309
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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