Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 669
  • Last Modified:

FindWindow

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
ibs22
Asked:
ibs22
  • 3
  • 2
  • 2
1 Solution
 
alexoCommented:
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
 
nietodCommented:
Another posibility is that the blank is more than one space in a row (or more than one non-printable character).  
0
 
ibs22Author Commented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
nietodCommented:
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
 
alexoCommented:
I see you have accepted my answer.  Does it mean that the solution was correct?  What was the problem?
0
 
ibs22Author Commented:
I was missing a space and I was also trying to use the FindWindow function for a console.
Thank You

0
 
alexoCommented:
Have fun!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now