-
January 4th, 2006, 10:55 PM
#1
Searching for file on hard drives
I need to launch another guy's executable from my app's menu item.
The problem is that the user can install that executable anywhere on the system, either before or after they install my app. The other guy is not writing any info about his app's location to registry.
I've started by looping through the system drives and doing FindNextFile(), checking to see if it's a directory and if so, checking all the files inside, etc. (See below.) But I'm thinking there has to be a better way. If anyone has some suggestions or sample code to share, I'd sure appreciate it.
Code:
WIN32_FIND_DATA &findData;
HANDLE hFind;
while ( FindNextFile( hFind, &findData ) )
{
if ( findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{
// search for files in this directory
}
else if ( findData.cFileName == otherGuysExecutableName )
{
// return absolute path to executable
}
}
-
January 5th, 2006, 12:42 AM
#2
Re: Searching for file on hard drives
It takes seconds for rating…that actually compensates the minutes taken for giving answers
The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
Regards, Be generous->Rate people
Jayender!!
-
January 5th, 2006, 02:31 AM
#3
Re: Searching for file on hard drives
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|