Re: [Dev-C++] How do you find a file's path?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Abhijit S. <mu...@gm...> - 2003-01-22 05:13:37
|
Greets, Philippe. > Hello, > > I have developed a basic application using C++-Dev that creates a > process that runs IExplorer. Unfortunately, CreateProcess will not > launch IExplorer unless I specify the latter's complete path (e.g., > C:\program files\Explorer\ieexplore.exe) as second parameter value: > CreateProcess( NULL, "C:\\Program Files\\Explorer\\Iexplore.exe", ...). > I would like to search for IExplorer on the user's PC before creating > the process. What is the easiest way to do that on Windows? > > Many thanks. > > Philippe de Rochambeau You'll have to do a recursive search on all available disks, or, if you want to save time, only on the primary disk (the one with windows - use GetWindowsDirectory() for identifying it), using FindFirstFile() and FindNextFile(). Note that, though spawn(), exec(), system(), WinExec() etc. will work, they are not the most efficient ways of executing external processes on Windows, CreateProcess() is. See my (basic) helper class: http://mudeth.tripod.com/rsearch.htm for reference. ___________________________________________________________ Abhijit Shylanath mu...@gm... http://mudeth.tripod.com/ |