Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Using the "FindWindow" function from the User32.dll

Posted on 1999-08-02
Medium Priority
Last Modified: 2008-02-26
in my prog. , i'm trying to find in run time whether the microsoft word is running already or not, by using the "FindWindow" function from the user32.dll API.
my question is :when i use this function (FindWindow), i must insert as argument the window name i would like the function to search for.
does anynoe know the name of microsoft word, in order the function will tell me if it's already running or not.
Question by:RnS
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
  • 3
LVL 14

Accepted Solution

waty earned 400 total points
ID: 1528883
Take a look here, it will solve your problem :

Expert Comment

ID: 1528884
The name of the window is the text written in the blue title bar at the top of the window.

Note: the full title of the window may change depending on what file you have open.

Ie: Untitled - Notepad may become Myfile - Notepad where MyFile is the name of the file you have open.


Doh, Waty answered while I was writing this, oh well. Guess I'll have to learn to type faster :)
May as well post it as a comment, although I'm sure waty's answer will be correct.
LVL 14

Expert Comment

ID: 1528885
Both our answer are correct stewfidgeon, mine is a link to an explanation on how to do the work.

Anyway, here is another link :

"How do I find out if a particular program is running when I don't know the entire window caption?" Ever asked that question? Then this demo Is For you! Provides a custom FindWindowPartial Function that returns the handle of the first window that matches your search criteria. You can search For window captions that start With, Or contain, any substring you wish. Perfect For apps that show both their own Name And the Name of the active document In the titlebar.

Some of the APIs used include EnumWindows, FindWindow, GetWindow, GetWindowText, IsIconic, SetForegroundWindow, ShowWindow And more.

Featured In my Programming Techniques column, VBPJ, September 1995
And Ask the VB Pro column, VBPJ, June 1998.
Provided As VB4-16/32 conditionally-compiled source, And VB5 32-bit.    (7K) :

LVL 14

Expert Comment

ID: 1528886
NB : I use my VBCodeDatabase to respond, it contains lots of useful knowledge, and I can respond to almost arround 60% of questions easily using this :)

Take a look to my web for a shareware version :)

Expert Comment

ID: 6872188

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.
Thank you,
Moderator @ Experts Exchange

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 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