Solved

How do I get Class name of CWnd Object ?

Posted on 2000-04-01
3
3,631 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: 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

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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

705 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