Ask the user? Seriously, there really isn't a "single" way to do this. Most programs can be located in the registry, but there is no single standard - you may need a different technique for each specific application (and/or version <s>).
You could search all the directories for a specific file name, but even that wouldn't guarentee it was "installed". Also, since some programs allow installation on a shared server, it could take a very long time to scan for all the possibilities.
Have you got a specific program or small set of them that concern you?
Rick