Registry Viewing in Progress

Hi All,

If I wanted to find something in the registry programatically (eg, path for Adobe Acrobat Reader), how would I go about this? I have not played with the registry, other than Regedit. Any help you can offer would be appreciated.

Thanx in advance,
Cya's
 
Assuming the adobe directory is in HKEY_CLASSES_ROOT\Applications\adobe.exe\shell\open\command the following code should be able to fetch its value.

Code:
def var vAns as char no-undo.

load "Applications\adobe.exe\shell\open" base-key "HKEY_CLASSES_ROOT".
use "Applications\adobe.exe\shell\open".

get-key-value section "command" key default value vAns.

unload "Applications\adobe.exe\shell\open".

message vAns view-as alert-box.
 
A little tip : when you try to search which application is linked to a given extension (.doc, .rtf, .csv, .pdf....), you should better do this like that :

DEF VAR c_extension AS CHAR NO-UNDO. /* Extension like '.doc' , '.pdf'... */
DEF VAR c_application AS CHAR NO-UNDO. /* App name */
DEF VAR c_program AS CHAR NO-UNDO. /* full path to app name */

ASSIGN c_extension = ".pdf".

/* open 1st registry : search application name */

LOAD c_extension BASE-KEY "HKEY_CLASSES_ROOT" NO-ERROR.
IF ERROR-STATUS:ERROR THEN RETURN "ERROR".

USE c_extension.
GET-KEY-VALUE SECTION "" KEY DEFAULT VALUE c_application. /* Give you the name of the app */
UNLOAD c_extension.

/* open 2nd registry : search exe full path */

LOAD c_application BASE-KEY "HKEY_CLASSES_ROOT" NO-ERROR.
IF ERROR-STATUS:ERROR THEN RETURN "ERROR".

USE c_application.
GET-KEY-VALUE SECTION "shell\Open\command" KEY DEFAULT VALUE c_program.
UNLOAD c_application.

/* Remove all unneed chars */

c_program = REPLACE(c_program,"%1","").
c_program = REPLACE(c_program,"%2","").
c_program = REPLACE(c_program,"%3","").
IF INDEX ( c_program , "/" ) > 2
THEN c_program = SUBSTRING(c_program,1,INDEX ( c_program , "/" ) - 1).
c_program = REPLACE(c_program,CHR(34),"").
c_program = TRIM(c_program).

/* Display full exe path */

MESSAGE c_program. /* Give you full path to the exe linked to your extension */



Second,

I have a problem when using this statement under Windows XP or Windows 2000, with a non-administrator user. It seems that you have to access the registry in Read-only mode....but how to do that in Progress V9 ? (In Delphi this is done with a TRegistry.Access := KEY_READ).

Anybody ?
 
Olivier_Desmars said:
..snip..
Second,

I have a problem when using this statement under Windows XP or Windows 2000, with a non-administrator user. It seems that you have to access the registry in Read-only mode....but how to do that in Progress V9 ?
You could use the RegOpenKeyExA API call from advapi32.dll as shown in Progress Solution ID 21622.
 
Top