Microsoft KB Archive/215362

= How To Detect DCOM Installation Under VFP 6.0 =

Article ID: 215362

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q215362



SUMMARY
This article illustrates how to detect whether DCOM is installed in a Windows 95/98 or a Windows NT 4.0 machine from within Visual FoxPro 6.0.



MORE INFORMATION
An application created with a Top-Level form needs DCOM installed in order to work properly when the Visual FoxPro main desktop is suppressed in the Config.fpw with SCREEN=OFF.

With the code below, you can detect that DCOM is present. Based on this information, you can shut down the application if necessary.


 * 1) DEFINE HKEY_LOCAL_MACHINE -2147483646
 * 2) DEFINE DCOMKEYSTRING 'SOFTWARE\Microsoft\OLE'
 * 3) DEFINE ENABLEDCOMKEY 'EnableDCOM'

SET CLASSLIB TO HOME+"ffc/REGISTRY.VCX" oReg=CREATEOBJECT('registry') LOCAL lFoundDCOM lFoundDCOM = .F. IF oReg.OpenKey(DCOMKEYSTRING,HKEY_LOCAL_MACHINE,.F.) = 0 LOCAL cValue cValue = '' IF oReg.GetKeyValue(ENABLEDCOMKEY,@cValue) = 0 lFoundDCOM = !EMPTY(cValue) ENDIF ENDIF IF !lFoundDCOM MESSAGEBOX('DCOM not install on system') ELSE MESSAGEBOX('DCOM install on system') ENDIF

