Solved

Window class names

Posted on 1997-06-19
2
739 Views
Last Modified: 2010-08-05
How do I determine what an application's window class name is.  This is for use with the FindWindow() function.

HWND FindWindow(
    LPCTSTR  lpClassName,      // address of class name
    LPCTSTR  lpWindowName       // address of window name
   );

An example I have shows how to look for WinWord running with the window classname = "OpusApp".  However, I need to look for more than just Word running.  I tried checking the Win95 registry for "OpusApp" to see if this info was stored there, but no luck.

Can someone point me in the right direction.

Thanks,
Jody


0
Comment
Question by:jodyl
2 Comments
 
LVL 1

Accepted Solution

by:
strobert earned 200 total points
ID: 1163988
In spite of what the docs on FindWindow may say, you should be able to call Findwindow with a NULL as the first parameter and a window title as the second, and it will give you back the top-level window with that title.

I have used this method before, so if you know the captions for the programs you are looking for, this should work.  

Otherwise using spy++ from microsoft or winsight from borland will let you see the application's class.
0
 

Author Comment

by:jodyl
ID: 1163989
Spy++ did the trick.  Thanks.

BTW, I needed to know the class name because some apps, such as Word, put the name of the current document in the main window title so I can't always be sure of the title name.

Jody

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

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