Página 1 de 1
Obtaining registry key
Publicado: Lun Ago 27, 2007 1:23 pm
por Stephan Hennekens
Hi,
I need to check in my program if a a certain ActiveX component is
registered. I use - unsuccessfully - the following code:
//---------------------------------------------------------- --------------------
STATIC FUNCTION RegisterRMChartX()
LOCAL cRegPath :=
" HKEY_CLASSES_ROOTCLSID{8E2EA06D-6ACA-4E52-9D5D-3CE2A89A15B E}ProgID "
LOCAL oReg := TRegistry():New()
LOCAL cValue
cValue := oReg:GetString(cRegPath)
// the return value is an empty string where it should be
"RMChart.RMChartX"
IF cValue != "RMChart.RMChartX"
// register component
ENDIF
RETURN Nil
Can some help me out here?
Regards,
Stephan
Obtaining registry key
Publicado: Lun Ago 27, 2007 1:41 pm
por notengo
Stephan,
> I need to check in my program if a a certain ActiveX component is
> registered. I use - unsuccessfully - the following code:
this should do the trick:
METHOD Button1Click( oSender ) CLASS TForm1
LOCAL cValue
WITH OBJECT TRegistry():New()
:Root := HKEY_CLASSES_ROOT
IF :OpenKey( "RMChart.RMChartXClsid" ) == 0
cValue := :GetString( "" ) // Gets the default value
IF Empty( cValue )
DllRegisterServer( "<path>rmchart.ocx" )
ENDIF
:CloseKey()
ENDIF
END
RETURN Nil
Let me know if it helps.
Regards,
José Lalín
Obtaining registry key
Publicado: Lun Ago 27, 2007 1:41 pm
por notengo
Stephan,
> I need to check in my program if a a certain ActiveX component is
> registered. I use - unsuccessfully - the following code:
this should do the trick:
METHOD Button1Click( oSender ) CLASS TForm1
LOCAL cValue
WITH OBJECT TRegistry():New()
:Root := HKEY_CLASSES_ROOT
IF :OpenKey( "RMChart.RMChartXClsid" ) == 0
cValue := :GetString( "" ) // Gets the default value
IF Empty( cValue )
DllRegisterServer( "<path>rmchart.ocx" )
ENDIF
:CloseKey()
ENDIF
END
RETURN Nil
Let me know if it helps.
Regards,
José Lalín
Obtaining registry key
Publicado: Lun Ago 27, 2007 2:11 pm
por Stephan Hennekens
Thanks a lot José (for great support, again),
after moving the the three lines of your code it worked perfectly.
Not the code is:
LOCAL cValue
WITH OBJECT TRegistry():New()
:Root := HKEY_CLASSES_ROOT
IF :OpenKey("RMChart.RMChartXClsid") == 0
cValue := :GetString("") // Gets the default value
:CloseKey()
ENDIF
IF Empty(cValue)
DllRegisterServer(GetPathFile(Application:cFilename) +
"rmchart.ocx")
ENDIF
END
:OpenKey("RMChart.RMChartXClsid") == 0 is only TRUE if the component is
registered.
Regards,
Stephan
"José Lalín" <
notengo@correo.com> wrote in message
news:[email=
46d2b8c3@ozsrv2.ozlan.local...]
46d2b8c3@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> I need to check in my program if a a certain ActiveX component is
>> registered. I use - unsuccessfully - the following code:
>
> this should do the trick:
>
> METHOD Button1Click( oSender ) CLASS TForm1
>
> LOCAL cValue
>
> WITH OBJECT TRegistry():New()
> :Root := HKEY_CLASSES_ROOT
> IF :OpenKey( "RMChart.RMChartXClsid" ) == 0
> cValue := :GetString( "" ) // Gets the default value
> IF Empty( cValue )
> DllRegisterServer( "<path>rmchart.ocx" )
> ENDIF
> :CloseKey()
> ENDIF
> END
>
> RETURN Nil
>
> Let me know if it helps.
>
> Regards,
> José Lalín
Obtaining registry key
Publicado: Lun Ago 27, 2007 2:11 pm
por Stephan Hennekens
Thanks a lot José (for great support, again),
after moving the the three lines of your code it worked perfectly.
Not the code is:
LOCAL cValue
WITH OBJECT TRegistry():New()
:Root := HKEY_CLASSES_ROOT
IF :OpenKey("RMChart.RMChartXClsid") == 0
cValue := :GetString("") // Gets the default value
:CloseKey()
ENDIF
IF Empty(cValue)
DllRegisterServer(GetPathFile(Application:cFilename) +
"rmchart.ocx")
ENDIF
END
:OpenKey("RMChart.RMChartXClsid") == 0 is only TRUE if the component is
registered.
Regards,
Stephan
"José Lalín" <
notengo@correo.com> wrote in message
news:[email=
46d2b8c3@ozsrv2.ozlan.local...]
46d2b8c3@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> I need to check in my program if a a certain ActiveX component is
>> registered. I use - unsuccessfully - the following code:
>
> this should do the trick:
>
> METHOD Button1Click( oSender ) CLASS TForm1
>
> LOCAL cValue
>
> WITH OBJECT TRegistry():New()
> :Root := HKEY_CLASSES_ROOT
> IF :OpenKey( "RMChart.RMChartXClsid" ) == 0
> cValue := :GetString( "" ) // Gets the default value
> IF Empty( cValue )
> DllRegisterServer( "<path>rmchart.ocx" )
> ENDIF
> :CloseKey()
> ENDIF
> END
>
> RETURN Nil
>
> Let me know if it helps.
>
> Regards,
> José Lalín
Obtaining registry key
Publicado: Lun Ago 27, 2007 2:55 pm
por notengo
Stephan,
> Thanks a lot José (for great support, again),
You are welcome !
> after moving the the three lines of your code it worked perfectly.
Ok.
> :OpenKey("RMChart.RMChartXClsid") == 0 is only TRUE if the component is
> registered.
OpenKey returns TRUE if the key exists and the caller has enough permission
to open it. To check if registered just check is cValue is not empty.
Regards,
José Lalín
Obtaining registry key
Publicado: Lun Ago 27, 2007 2:55 pm
por notengo
Stephan,
> Thanks a lot José (for great support, again),
You are welcome !
> after moving the the three lines of your code it worked perfectly.
Ok.
> :OpenKey("RMChart.RMChartXClsid") == 0 is only TRUE if the component is
> registered.
OpenKey returns TRUE if the key exists and the caller has enough permission
to open it. To check if registered just check is cValue is not empty.
Regards,
José Lalín
Obtaining registry key
Publicado: Lun Ago 27, 2007 4:10 pm
por Stephan Hennekens
Oke, thanks for the explanation!
Regards,
Stephan
"José Lalín" <
notengo@correo.com> wrote in message
news:46d2ca1d$[email=
1@ozsrv2.ozlan.local...]
1@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> Thanks a lot José (for great support, again),
>
> You are welcome !
>
>> after moving the the three lines of your code it worked perfectly.
>
> Ok.
>
>> :OpenKey("RMChart.RMChartXClsid") == 0 is only TRUE if the component is
>> registered.
>
> OpenKey returns TRUE if the key exists and the caller has enough
> permission to open it. To check if registered just check is cValue is not
> empty.
>
> Regards,
> José Lalín
Obtaining registry key
Publicado: Lun Ago 27, 2007 4:10 pm
por Stephan Hennekens
Oke, thanks for the explanation!
Regards,
Stephan
"José Lalín" <
notengo@correo.com> wrote in message
news:46d2ca1d$[email=
1@ozsrv2.ozlan.local...]
1@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> Thanks a lot José (for great support, again),
>
> You are welcome !
>
>> after moving the the three lines of your code it worked perfectly.
>
> Ok.
>
>> :OpenKey("RMChart.RMChartXClsid") == 0 is only TRUE if the component is
>> registered.
>
> OpenKey returns TRUE if the key exists and the caller has enough
> permission to open it. To check if registered just check is cValue is not
> empty.
>
> Regards,
> José Lalín