Re: SystemRoot: XP vs VISTA



Tom de Neef wrote:
In a borrowed piece of code (for html help) I have

Reg.RootKey := HKEY_CLASSES_ROOT;
if Reg.OpenKeyReadOnly(hhPathRegKey)
then result := Reg.ReadString('');

Under XP this result in 'C:\WINDOWS\System32\hhctrl.ocx'

My application didn't open the help system under Vista because the same code then results in
'%SystemRoot%\System32\hhctrl.ocx'

By searching with regedit I've discovered that SystemRoot is defined in
'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion'
With StringReplace I now substitute the parameter.

That registry key is stored with reference to an environment variable. Use the ExpandEnvironmentStrings API function to replace the environment variable with its actual value. Don't dig around in the registry any more than you absolutely have to.

The registry has a data type for storing environment-variable-based values. When you read from those keys, the OS is supposed to fill in the actual value for you. Check (in regedit.exe) the type of the key you're reading. Is it Reg_Expand_Sz, or just Reg_Sz? This is to determine whether it's the OS that is using the wrong type, or Delphi that is ignoring that type. You can't fix the former, but you can address the latter.

--
Rob
.



Relevant Pages

  • Re: SystemRoot: XP vs VISTA
    ... My application didn't open the help system under Vista because the same code then results in ... Is there a standard way of replacing windows parameters in the paths found in the registry? ...
    (comp.lang.pascal.delphi.misc)
  • Re: Deactivation of windows help and support
    ... the solution to my CorelDraw problem. ... notebook and they both had Vista bundled whether I liked it or not. ... in previous versions of Windows and it is not supported in Windows Vista ... There are NO issues running the older help system along side the newer ...
    (microsoft.public.windows.vista.general)
  • Re: Device Detected Dialog Box
    ... "Jim Carlock" wrote: ... > through your registry for references to the device. ... > HKU for HKEY_USERS items. ... >> the XP Help system right at the moment. ...
    (microsoft.public.windowsxp.general)
  • Re: HLP Files in Vista?
    ... Dos is more dated and still in Vista. ... add custom welcome pages etc. ... convert my help system generation, buy/upgrade my tools (and worse, invest ... time in them to learn them), rewrite custom tools and scritps, and I have no ...
    (borland.public.delphi.non-technical)
  • Re: Deactivation of windows help and support
    ... and support' with the message:- ... in previous versions of Windows and it is not supported in Windows Vista ... help system - you can download it from Microsoft's site, although I can't be sure this will cure your problem. ... You should have found out which of your programs was compatible with Vista before upgrading to it. ...
    (microsoft.public.windows.vista.general)