[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 489
  • Last Modified:

Using the "FindWindow" function from the User32.dll

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.
  • 3
1 Solution
Take a look here, it will solve your problem :
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.
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)

FindPart.zip : http://www.mvps.org/vb/code/FindPart.zip

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 :)

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

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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