Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 2nd, 2024, 7:14 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Search for a file
PostPosted: September 23rd, 2005, 1:13 pm 
Offline

Joined: April 21st, 2005, 4:47 pm
Posts: 43
Location: Southampton, UK
Hi

I need to ascertain programmatically if a start menu shortcut exists. Problem is, this may vary according to (a) who had installed the original app and (b) part of the wording of the shortcut which was determined by the original installation:

Quote:
C:\Documents and Settings\<User or "All users"> \Start Menu\Programs\<Variable string>\Shortcut


How can I set up a wildcard search?

Thanks, Linnet

_________________
A crack on the head / Is what you get for not asking
And a crack on the head / Is what you get for asking

Barbarism Begins At Home, The Smiths


Top
 Profile  
 
 Post subject:
PostPosted: September 23rd, 2005, 1:40 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
You can't just assume that everything is in C:\Documents and Settings\ - it may not be true for all users and certainly not under international versions of Windows. You can find however the information from the registry.

For the current user, the directories for the Start Menu, Programs, and Startup are stored in:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
as the values "Start Menu", "Programs" and "Startup", respectively.

The "AllUsers" start menu paths can be found in:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
(Note the change of root key!), under "Common Start Menu", "Common Programs" and "Common Startup"

As to searching; if you have a known list of possibilities then an simple
Code:
if ( FileExists(I am a spammer) )
{
   // ... something
}
else if ( FileExists(yyy) )
{
   // ... something else
}
else....

would suffice.

Otherwise you are really getting into the realm of an external program to find the files for you. You could use the IShellLink COM interface to parse the links (the Microsoft approved way of working with shortcuts), or you could do it "manually" with FindFirstFile(), FindNextFile() API calls. The prgram could write the result to a known registry key and Opus could then read that.

_________________
ddww Opus Developer


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group