Solved

FindWindow

Posted on 1998-09-16
7
643 Views
Last Modified: 2012-06-22
The FindWindow function(Win32 API) does not find a window if the name is not one word.
FindWindow(NULL, "Calculator") - no problem
FindWindow(NULL, "My Program") - problem
What could be the problem
Thank You
0
Comment
Question by:ibs22
  • 3
  • 2
  • 2
7 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 100 total points
ID: 1172882
It works perfectly OK.  Start regedit.exe and try FindWindow(NULL, "Registry Editor")

Possible reasons for your problem:

* The title contains other blank or non-printable characters.  Check with Spy++ or a similar tool.

* The letter case is incorrect.  The matching is case-sensitive!

* Your window is not a top-level window.  Check with Spy++ or a similar tool.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1172883
Another posibility is that the blank is more than one space in a row (or more than one non-printable character).  
0
 

Author Comment

by:ibs22
ID: 1172884
The title of the window I am trying to find is
Engineering Work Station(EWS)
When you mentioned the title contains other blanks, would the second blank in the title  cause a problem.

It is a top-level window.
Thank You
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 22

Expert Comment

by:nietod
ID: 1172885
No.  All that matters is that your search string matches the string in the title exactly.  For example, If you put a space before the "(EWS)" and they don't, you won't find it.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1172886
I see you have accepted my answer.  Does it mean that the solution was correct?  What was the problem?
0
 

Author Comment

by:ibs22
ID: 1172887
I was missing a space and I was also trying to use the FindWindow function for a console.
Thank You

0
 
LVL 11

Expert Comment

by:alexo
ID: 1172888
Have fun!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

759 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

20 Experts available now in Live!

Get 1:1 Help Now