 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
HarryS Guest
|
Posted: Fri Feb 04, 2005 7:25 pm Post subject: Retrieving Program Groups |
|
|
I'm currently using the following to retreive a list of Program Groups:
if DDEClientConv1.SetLink ('Progman','Progman') then
ComboBox1.Items.SetText(DDEClientConv1.RequestData('Groups'));
The problem is that this returns ALL of the groups and I need to return only
the groups under the current user (HKEY_CURRENT_USER). Does anyone know how
I should go about this?
When I run the program, the combobox list shows two instances of the group
I'm after, however, selecting one of them works and selecting the other
doesn't. What's odd to me is that I can find only one instance of the group
on the C: drive under ANY kind of user so I can't figure where the second
instance is coming from.
I've spent a considerable amount of time searching the web for something on
this, and haven't been able to find anything.
Thanks,
Harry
|
|
| Back to top |
|
 |
Rob Kennedy Guest
|
Posted: Fri Feb 04, 2005 8:21 pm Post subject: Re: Retrieving Program Groups |
|
|
HarryS wrote:
| Quote: | if DDEClientConv1.SetLink ('Progman','Progman') then
ComboBox1.Items.SetText(DDEClientConv1.RequestData('Groups'));
The problem is that this returns ALL of the groups and I need to return only
the groups under the current user (HKEY_CURRENT_USER).
|
What do you mean? What does the registry have to do with anything?
| Quote: | Does anyone know how I should go about this?
When I run the program, the combobox list shows two instances of the group
I'm after, however, selecting one of them works and selecting the other
doesn't.
|
What do you mean "works"? The combo box doesn't let you select it?
| Quote: | What's odd to me is that I can find only one instance of the group
on the C: drive under ANY kind of user so I can't figure where the second
instance is coming from.
I've spent a considerable amount of time searching the web for something on
this, and haven't been able to find anything.
|
I think what you're looking for is a list of all the top-level
start-menu folders where your installation tool could place a new
shortcut icon, right? If that's the case, then ditch DDE and start
looking at the file system since that's ultimately where the shortcut
will go.
The Start menu is constructed from the union of the user's own profile
folder and the "all users" profile folder. Folders from the two
hierarchies get merged together if they share a name. To find out where
they are, call the ShGetFolderPath API function once each with the
Csidl_Programs and Csidl_Common_Programs flags. I demonstrate that at
the bottom of the site below.
http://www.cs.wisc.edu/~rkennedy/?my-documents
I wonder why you're writing your own installation tool when there are
already so many out there. Personally, I'm rather fond of Inno Setup.
--
Rob
|
|
| Back to top |
|
 |
HarryS Guest
|
Posted: Fri Feb 04, 2005 10:33 pm Post subject: Re: Retrieving Program Groups |
|
|
"Rob Kennedy" <me3 (AT) privacy (DOT) net> wrote
| Quote: | HarryS wrote:
if DDEClientConv1.SetLink ('Progman','Progman') then
ComboBox1.Items.SetText(DDEClientConv1.RequestData('Groups'));
The problem is that this returns ALL of the groups and I need to return
only
the groups under the current user (HKEY_CURRENT_USER).
What do you mean? What does the registry have to do with anything?
|
I guess I assumed that the DDE call was retrieving the information from the
registry. If it's actually coming from the file system, then that's a
different matter and I can work out retrieving the groups from there.
| Quote: |
Does anyone know how I should go about this?
When I run the program, the combobox list shows two instances of the
group
I'm after, however, selecting one of them works and selecting the other
doesn't.
What do you mean "works"? The combo box doesn't let you select it?
|
I'm in the process of switching from DDE for setting up the shortcuts to
using ShellLink and I'm pulling the 'Desktop' and 'Programs' locations from
HKEY_CURRENT_USER. I've made the switch to ShellLink and that works OK.
What I'm getting at above is if I pick a group from the combobox that's not
a group under the current user, the links aren't created. I'm assuming
that's because the group that was selected is not in the 'Programs' ShellDir
of HKEY_CURRENT_USER.
When I was using DDE to create the links, the links went to All Users (not
because I overtly caused it, but because the code I had used put them there
and I was satisfied with that). When I tried switching to HKEY_USERS in the
ShellLink code (which I assumed to be All Users), the same ShellLink code
doesn't work. If HKEY_USERS is not what I'm supposed to be using to obtain
the 'Programs' ShellDir, maybe you could clear that up for me? I'd actually
rather be putting my folder in All Users.
| Quote: |
What's odd to me is that I can find only one instance of the group
on the C: drive under ANY kind of user so I can't figure where the
second
instance is coming from.
I've spent a considerable amount of time searching the web for something
on
this, and haven't been able to find anything.
I think what you're looking for is a list of all the top-level
start-menu folders where your installation tool could place a new
shortcut icon, right? If that's the case, then ditch DDE and start
looking at the file system since that's ultimately where the shortcut
will go.
|
In a nut shell, Yes. The above code was the only piece of DDE left so it'll
have to go also.
| Quote: | The Start menu is constructed from the union of the user's own profile
folder and the "all users" profile folder. Folders from the two
hierarchies get merged together if they share a name. To find out where
they are, call the ShGetFolderPath API function once each with the
Csidl_Programs and Csidl_Common_Programs flags. I demonstrate that at
the bottom of the site below.
http://www.cs.wisc.edu/~rkennedy/?my-documents
|
Thanks, that looks like exactly what I need. Can you explain a little
regarding the two folders getting merged?
| Quote: |
I wonder why you're writing your own installation tool when there are
already so many out there. Personally, I'm rather fond of Inno Setup.
|
I have some German ancestry and I think when I was born, my parents claim
they applied a line of code to my brain to the effect
const
Harry = HardHeaded;
I'm having a hard time overcoming it. ;-)
I wrote my own installation and uninstallation utilities long ago, in the
early Delphi days, using DDE. I learned some doing that and I'm learning
more now. I've considered getting a commercial utility after I've figured
out a way to hack into my brain to rearrange things. It would certainly be
an easier way.
Harry
|
|
| Back to top |
|
 |
Tom de Neef Guest
|
Posted: Fri Feb 04, 2005 11:09 pm Post subject: Re: Retrieving Program Groups |
|
|
| Quote: |
I have some German ancestry and I think when I was born, my parents claim
they applied a line of code to my brain to the effect
const
Harry = HardHeaded;
I'm having a hard time overcoming it. ;-)
I wrote my own installation and uninstallation utilities long ago, in the
early Delphi days, using DDE. I learned some doing that and I'm learning
more now. I've considered getting a commercial utility after I've figured
out a way to hack into my brain to rearrange things. It would certainly
be
an easier way.
|
Inno Setup is shareware. It works reliably. Certainly worth looking at. No
doubt your head will find something else to bang against.
Tom
|
|
| Back to top |
|
 |
Rob Kennedy Guest
|
Posted: Fri Feb 04, 2005 11:58 pm Post subject: Re: Retrieving Program Groups |
|
|
HarryS wrote:
| Quote: | I guess I assumed that the DDE call was retrieving the information from the
registry. If it's actually coming from the file system, then that's a
different matter and I can work out retrieving the groups from there.
|
With DDE, you're talking the the Program Manager window. That concept
actually made sense ten years ago, but not so much anymore. Program
Manager replies in a way that's meant to be compatible with the way it
worked in Windows 3.1, when there weren't multiple users and there
weren't nested program groups.
Where Program Manager gets its answers from is none of our business.
| Quote: | I'm in the process of switching from DDE for setting up the shortcuts to
using ShellLink and I'm pulling the 'Desktop' and 'Programs' locations from
HKEY_CURRENT_USER.
|
Well, stop it. Use the API functions. They will work independently of
the registry layout. That the folder locations are even stored in a
predictable place in the registry is because some programs written
before Windows 95's release were looking for them before the API
functions had solidified.
http://weblogs.asp.net/oldnewthing/archive/2003/11/03/55532.aspx
| Quote: | What I'm getting at above is if I pick a group from the combobox that's not
a group under the current user, the links aren't created. I'm assuming
that's because the group that was selected is not in the 'Programs' ShellDir
of HKEY_CURRENT_USER.
|
Well, you're the one writing the program, so which directory did you
tell it to use? Debug the program, step through it, and look at the
values of the string variables that hold the path.
Also, have you checked the return values of all the functions to
determine which ones, if any, are failing? It could be a permissions
issue (which is part of the reason there even *are* two separate
directory trees).
| Quote: | When I was using DDE to create the links, the links went to All Users (not
because I overtly caused it, but because the code I had used put them there
and I was satisfied with that). When I tried switching to HKEY_USERS in the
ShellLink code (which I assumed to be All Users), the same ShellLink code
doesn't work. If HKEY_USERS is not what I'm supposed to be using to obtain
the 'Programs' ShellDir, maybe you could clear that up for me?
|
Use the code from the page I refered you to in my previous message.
HKey_Users is where *all* the users' registry keys are kept. (At least
the keys that are loaded into memory at the time. Only logged-in users'
keys are loaded, usually.) But settings for all users don't apply to any
particular user, so they aren't stored in HKey_Users. Instead, they live
in HKey_Local_Machine.
| Quote: | I'd actually rather be putting my folder in All Users.
|
When the user running the installer is not an administrator, you should
not install anything in the All Users folder. The user generally doesn't
have permission to do that. Install things into the user's own profile
directory instead.
When the installer is an administrator, then it usually makes sense to
ask where to install things -- whether to install just for the
administrative user or for everyone on the system.
| Quote: | Thanks, that looks like exactly what I need. Can you explain a little
regarding the two folders getting merged?
|
On your own computer, look at your two start-menu directories. There
should be one in Documents and SettingsAll UsersStart Menu, and
another in Documents and Settings<your profile name>Start Menu. They
should have similar structures.
On my system, my profile's folder has a "Programming" group, where I
keep shortcuts to Delphi and other programming tools. My All Users
folder has a "Utilities" group, which has shortcuts to WinZip, the
registry editor, Acrobat Reader, and a bunch of other things. When I'm
logged in as myself, I see both those folders on my Start menu. When I'm
logged in as Administrator, I don't see the Programming group. I do see
the Utilities group.
My All Users folder also has an Internet folder, where there are
shortcuts to Firefox, Thunderbird, and my SSH client. No matter whom I'm
logged in as, I see those icons. My Administrator profile folder _also_
has an Internet folder. I contains only one icon, for Internet Explorer.
When I'm logged in as Administrator, I get the IE icon, *plus* the other
three. So the contents of the folders are "merged" to create a composite
Start menu, customized for every user account.
(If both the profile folder and the All Users folder have not only the
same folders but also the same shortcuts, then I don't recall what
happens. Either you get two entries in the menu, or one trumps the
other. I save myself the confusion by avoiding the situation entirely.)
--
Rob
|
|
| Back to top |
|
 |
|
|
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 vote in polls in this forum
|
|