Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Registering OCX Control
Message
 
À
27/06/2004 02:49:28
David Mckay
Australian Workplace Software
Sydney, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00917676
Message ID:
00923105
Vues:
19
>If you have a new version of a ocx control which is to go onto a computer which already has an existing ocx control. Can you copy the new one over the old control without registering it or do you have to register the new control?..
>
>Any help would be grateful
>
>Dave

Dave

I use the code below on start-up.

1. Given a control, let's say "FOO.OCX" located at cPath, try to instantiate it on a fake form: TestOCX("FOO.OCX").
2. If the test fails, then: DllRegisterServerOCX(ADDBS(cPath) + "FOO.OCX")

There could be situations where DllRegisterServer (the function called if you type RegSvr32 at the command line) will fail, e.g. insufficient permissions, so that should be protected with an error handler as well.

I use it to check that a errant version of Office hasn't deregistered the common controls (see KB).

John Burton

******************************************************

FUNCTION TestOCX
LPARAMETERS cTestControlName
LOCAL oTestForm
oTestForm = CREATEOBJECT("ACTIVEXTESTFORM", cTestControlName)
RETURN oTestForm.Passed
ENDFUNC

DEFINE CLASS ACTIVEXTESTFORM AS FORM

Passed = .T.

PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
THIS.Passed = .F.
ENDPROC

PROCEDURE Init
LPARAMETERS cTestControl
THIS.AddObject("oTestObj", cTestControl)
ENDPROC

ENDDEFINE

PROCEDURE DllRegisterServerOCX
LPARAMETERS cTestControlPath
DECLARE LONG DllRegisterServer IN (cTestControlPath)
= DllRegisterServer()
CLEAR DLLS DllRegisterServer
ENDPROC
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform