Highlighted
Absent Member.
Absent Member.
564 views

[archive] Reg_query_value

[Migrated content. Thread originally posted on 10 September 2003]

I am trying to query the windows registry to see if a certain active X control is loaded, I have used the following code

MOVE HKEY_LOCAL_MACHINE
TO OPEN-KEY-HANDLE.

MOVE "SOFTWARE/Classes/TypeLib/{912FB004-DD9A- 11D3-BD8D-DAAFCB8D9378}/1.0"
TO SUBKEY-NAME.

Call "REG_QUERY_VALUE"
USING OPEN-KEY-HANDLE,
RETURN-VALUE,
RETURN-SIZE,
SUBKEY-NAME,
GIVING STATUS-CODE.

The key does it exist and I always get a status code of 2
whether the key exists or not

Does anyone have any clue why this does not work, it should
return the name of the control in return value but it is always spaces.
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] Reg_query_value

Before calling REG_QUERY_VALUE, you need to call REG_OPEN_KEY to get the handle that you need for your OPEN-KEY-HANDLE variable. I don't think you can just move HKEY_LOCAL_MACHINE to your OPEN-KEY-HANDLE variable.

The way we check to see if an ActiveX control has been registered is just to use the call to REG_OPEN_KEY. If we get a status of zero returned, we know it's been registered. Otherwise we register it.

Example:

CALL "REG_OPEN_KEY" USING HKEY_LOCAL_MACHINE,
"Software\Classes\MSComCtl2.MonthView\CLSID", MV-REGISTRY-HANDLE
GIVING REG-STATUS-CODE.
IF REG-STATUS-CODE NOT = ZEROS
PERFORM REGISTER-CONTROL
ELSE
CALL "REG_CLOSE_KEY" USING MV-REGISTRY-HANDLE
END-IF.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.