Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close Adobe Acrobat

Status
Not open for further replies.

jherek

Technical User
Nov 16, 2003
15
GB
I need to be able to close any version of acrobat and acrobat reader. I tried using ClassNames - but apart from version 6 the classname seems to change each time a window is started. I can't use the Caption because I have no idea what document may be loaded by the user.

Any ideas on how I can find out if Acrobat is running - any version on any platform from Win 95 on... ??
 
jherek,

Search using Classname actually is a good idea. However sometimes they change it for each version.

The other way that I know (almost) always work is to compare part of the caption that always appear, such as "acrobat" or "reader". Enumerate the windows, start from Desktop. Get the text and compare it using case insensitive. It might fail for different version, or if other documents use that name as part of the caption. So after that you can also get the module name and compare it.

If you think of all the posibility, I don't think there is a way that guarantee always work! But almost always is good enough :)

My 0.02$
Regards

-- AirCon --
 

Thanks AirCon, that's what I was kind of leaning towards, problem is, we distribute hundreds of CDs to users all across the world, I would hate if I closed some app that wasn't Acrobat!! (Especially as it doesn't automatically save for the user...)
 
Yes, I know what you were trying to. I had experienced that. However all software is changing for each version even OSes.

Now, search for part of caption is actually better than search for classname. Why? because all software tends to put their name as part of the title (part of the title is still exist from version to version, eg.: Acrobat).

However (as I mentioned), if other documents also used it for the filename, it could fail! So we can trap another part of the caption such as ".pdf". So if it has "acrobat" and ".pdf" then you get the right one.

I don't know what is the part of caption because I don't have version 6. But you can study it an use that part to trap any possibility that you can think of. And you can also combine it with other method. How about part of the module name? :)

PS: they might still fail in the future
Regards

-- AirCon --
 
Another method that you can use is get the module/file version info. Usually the software always put Company Name and Software Title in the EXE header.

-- AirCon --
 
I'll try something like that. Thanks for the help :)
 
Design questions/suggestions rather than code:

MUST all Acrobat apps be closed automatically? If not, you can search for "Acrobat" in the title as suggested in prior posts and prompt the user to close each app containing the string.

It is probably best to tell the user what you are doing anyway instead of just trying to auto-kill programs (for you installer/updater?)

You could send a terminate message to each app and let it handle the closing message normally (i.e. prompt to save if document changed, etc.). However, suppose someone has a slow connection or had a hard time finding a .PDF file, yet forgot to explicitly save a local copy. The .PDF will be read-only and will probably close without prompting the user. Some users will know how to retrieve the file from their temp internet folders (or a link back to the file), but many will not. They are the ones that will be irritated the most at having their computer guess (incorrectly) their highest priority(ies).


I would say:

1) Prompt the user before any app search "All Acrobat applications must be closed before this operation can complete. Please save your work and then click Continue". Give THEM a chance to close gracefully.

2) Now search for apps with "Acrobat" in the title and send a Terminate/closing message to the app and let it handle the message normally.

Now if the user loses any data it is their own damn fault for not paying attention. :)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top