Solved

How do I get Class name of CWnd Object ?

Posted on 2000-04-01
3
3,327 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 28
GIF file bit manipulation for color change 5 107
viewing source code from eclipse 13 88
canBalance challenge 34 70
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…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

912 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now