Solved

FindWindow

Posted on 1998-09-16
7
653 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

806 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