> I suggest you re-read that post you point to. It says "The main problem is
> that the program is started from a local service before a user is logged
> into vista."
>
> So how exactly do you propose to read from HKCU in that circumstance ?
> You do realize that HKCU is the "current user" in the registry, right ?
>> I suggest you re-read that post you point to. It says "The main problem
> is
[quoted text clipped - 6 lines]
> Good point. I just noticed one of my first search links
> was talking about a problem with IsThemeActive.
Yes but the link you found applies either way as I pointed out to you. IOW:
you probably didn't read it properly or think about it, instead you posted
it as a defense for using a registry hack, when clearly the registry hack
would have the same if not more problems. Not sure if it translates to
there, but here that's usually called a "red herring" .
> Actually I thought that Dean Early made good points.
Yes he did/does.
> It was the adamant rule-bound approach I was questioning;
> the attitude that it's always better to follow rules than to
> use one's own judgment.
Dean said :
"Whatever you do, DON'T read this stuff from the registry, when there are
fully documented API calls to do this properly!!"
You seme to not be reading what he said, especially the qualifying part of
the sentence.
> I meant the link as an example of
> how it's not a black-and-white issue when it comes to
> Microsoft's officially suggested practices.
Well it wasn't. So perhaps some more thought before posting would have
helped ?
> (In the case of
> theme settings I found those by using Regmon to track
> where the Display applet was getting its info. Those Registry
> values seem to be the official place to store that info.)
It is NOT the official place to store that information. The *official* way
to read that information is via the documented API.
> A good example of things are not black and white when
> dealing with Windows programming is actually related to the
[quoted text clipped - 13 lines]
> it a "crufty Registry hack". :) But it seems to work on all
> systems, and that's what matters.
See :
http://vbnet.mvps.org/index.html?code/browse/csidl.htm
Note the "best practice" comment Randy put on the title. I won't rehash all
past conversation on this, suffice it to say exactly what Dean said :
"Whatever you do, DON'T read this stuff from the registry, when there are
fully documented API calls to do this properly!!"
If, and only *if*, the fully documented API calls don't do it properly for
you, then and only then resort to registry hacks.
> Another good example is the Vista problem with
> GetVersionEx. If a program is started by another program
[quoted text clipped - 4 lines]
> want to run on Vista, in any mode. So I have to cook up
> a non-official solution in order to get the job done.
Well I would call that an example of why you should use GetVersionEx, so
that the end user does get to set compatability mode.
> Naturally I get impatient when someone blurts out that
> NOOOOOO, you should never do that.
Well don't. Take your time, breathe, and digest what is written. There's
no race for a retort needed.
> That's like people
> standing on the deck of a sinking ship, after the captain's
> made his escape, shouting, "No! No! You're not supposed
> to lower the life boats until the captain says so!" Such people
> would rather drown following orders than risk trusting their
> own judgment.
That's another "red herring". Dean's advice was solid and good.
> As for broken compatibility in the future, that's always
> true. Anything has to be tested on a new system before
> it's used. Whatever method is used to get theme info., it
> has to be tested on Vista if someone wants to support Vista.
> It would be crazy to just assume that Microsoft didn't
> break anything moving forward.
Sure but you can't expect and support for using undocumented hacks.
Microsoft actually has an incredible brilliant track record of supporting
it's documented API, especially compared to other vendors. In the cases
where they do break the API they also just about always document that change
either in the API documentation and/or in KB articles. SO finding a
solution also gets a lot easier should you have to deal with those kind of
changes.
mayayana - 02 Sep 2008 14:35 GMT
I suppose I'll probably regret trying to respond to
your endless twisting of meanings, but for the sake
of clarity in this thread, maybe I should try to at least
straighten out a couple of kinks...
> > (In the case of
> > theme settings I found those by using Regmon to track
[quoted text clipped - 3 lines]
> It is NOT the official place to store that information. The *official* way
> to read that information is via the documented API.
----------
That's two different things: The official place to
store/retrieve the theme info. and the official way
to retrieve it.
You didn't give an explanation for the statement
that it's not the official place to store theme info. (The
official way to retrieve it is another matter.) Are you
saying that the Registry settings I listed are a willy
nilly bunch of arbitrary bloat that Windows does not use
consistently? And that the real settings are perhaps in
some INI file somewhere? If you know for certain then
maybe you could tell us so we can all do this hack right. :)
----------
> > A good example of things are not black and white when
> > dealing with Windows programming is actually related to the
[quoted text clipped - 18 lines]
>
> Note the "best practice" comment Randy put on the title.
> I won't rehash all
> past conversation on this, suffice it to say exactly what Dean said :
[quoted text clipped - 3 lines]
> If, and only *if*, the fully documented API calls don't do it properly for
> you, then and only then resort to registry hacks.
-------------
You're not answering to what I wrote. If you re-read it
you'll see that it's an example of how the API doesn't serve.
...Yet you want to send me to a link for documentation on
that same API.
The official MS "best practice" won't tell me the Program Files
folder path on Win9x and I'm not sure it even works on NT versions.
(I don't remember offhand.) The Registry read does seem to work.
(If it ever fails I haven't found the case, so it's at least more
dependable than the MS "best practice".) That's it. Very simple.
The fact that Randy Birch has documented the "best practice"
method has nothing to do with anything!
------------
> > Another good example is the Vista problem with
> > GetVersionEx. If a program is started by another program
[quoted text clipped - 7 lines]
> Well I would call that an example of why you should use GetVersionEx, so
> that the end user does get to set compatability mode.
--------------
No. Once again you're not answering to what I wrote.
I don't want the software to run on Vista. Period.
The GetVersionEx "bug" means that GetVersionEx is
not adequate to achieve that. Simple as that.
(Perhaps you think I have no right to not support Vista?
That's not for you to say.)
This is not about respecting or not respecting Microsoft.
It's not about "behaving" or cutting corners. It's not an
emotional issue or a loyalty issue or a religious issue. It's
about getting the job done in Windows. That's it. Simple.
And the best way to do that is to know as much as possible
about how Windows works, both the official operation and
the actual.
Bill McCarthy - 02 Sep 2008 15:02 GMT
> I suppose I'll probably regret trying to respond to
> your endless twisting of meanings
Mayayana, this "retort" of your is totally inappropriate. I'm not even
going to dignify the rest of your response with a detailed reply. You
posted here saying to use the registry, Dean posted saying to use the API.
You then attacked Dean demanding he post the API when he had already. You
then dig up some post you find somewhere and try to paint that as a reason
not to use the API. I again corrected you and pointed out that the in that
case you claimed, the registry hack would have made no difference. OS then
you go on trying to find other fringe cases, deliberately twisting what was
said. Here, let me again post *exactly* what Dean said:
> "Whatever you do, DON'T read this stuff from the registry, when there are
> fully documented API calls to do this properly!!"
And here, is what I said:
> If, and only *if*, the fully documented API calls don't do it properly for
> you, then and only then resort to registry hacks.
So unless you can actually give a *REAL* reason not to use the API detecting
if themes is on, then I suggest you give it a rest.
And please learn to chill out some and stop with the personal attacks
everytime you get something wrong.
mayayana - 02 Sep 2008 15:02 GMT
An interesting, ironic addendum to the discussion
on the various CSIDL methods and Registry hacks:
As I'd said, I use the method of reading the "ProgramFilesDir"
Registry value for the Program Files path because I found
the CSIDL methods don't work on at least some systems,
perhaps on all. The place I use that code is in my own rebuilt
version of Setup1.exe and I've never had any complaints.
Now, looking at the original version of setup1.exe,
it turns out that that's where I got my method in
the first place. Microsoft programmers used that method
in the VB6 Package and Deployment Wizard setup program.
:)
(ResolveDestDir function in Setup1.bas)
> > > A good example of things are not black and white when
> > > dealing with Windows programming is actually related to the
[quoted text clipped - 40 lines]
> The fact that Randy Birch has documented the "best practice"
> method has nothing to do with anything!
Dean Earley - 02 Sep 2008 15:09 GMT
> An interesting, ironic addendum to the discussion
> on the various CSIDL methods and Registry hacks:
[quoted text clipped - 10 lines]
>
> (ResolveDestDir function in Setup1.bas)
The PDW based setup isn't exactly the best model for good programming :)
As is said repeatedly, Microsoft teams are just about as bad as non MS
developers, and very few of them have any privileged access to anything
more than we do as "general public".

Signature
Dean Earley (dean.earley@icode.co.uk)
i-Catcher Development Team
iCode Systems