[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.
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.
[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.
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.