I have made a program that hooks into another, using their own API's. Now their API's don't tell me how to locate their program if its installed any place other then the defualt.
Well, I would prefer to have my little program locate their automaticly and not have to ask the user for the install location.
Is there a way I can do this? I have already looked at their registry values and their is not Install Location one like some program put in.
If it is possible to do, could somone point me to a tutorial, or post a code sample i would apperciate it very much.
Loading
GlennPosted Aug 28, 2007, 1:18 PM
Your post did point me a direction that has turned out to be a good solution for me.
Process[] process2 = Process.GetProcessesByName("Program");
int count = process2.Length;
if (count <= 0)
{
MessageBox.Show("Required Program is not yet running!");
}
else
{
ProcessModule PM = process2[0].MainModule;
string TargetDir = PM.FileName.Replace("Program.exe", "")
}
Again thanks for the help.
AlanPosted Aug 28, 2007, 11:33 AM
If the other program is already running, then you can use the System.Diagnostics.Process class to get a handle to it:
Process[] procs = Process.GetProcessesByName("otherAppName");
IntPtr ip = IntPtr.Zero;
if (procs.Length > 0)
ip = procs[0].Handle; // handle to first or only instance