Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Corrected DCOM detection
Message
From
11/01/1999 06:46:32
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Corrected DCOM detection
Miscellaneous
Thread ID:
00174593
Message ID:
00174593
Views:
58
Dragan found a bug in the code posted under the original FAQ entry describing how to detected DCOM. Under NT, the leading "\" in the registry key caused NT to error on the OpenRegKey call. I've reposted the entry with the correction; it should now read as:

VFP6 needs DCOM to be properly installed if you disable the VFP main windows through CONFIG.FPW; at termination, VFP will cause a C0000005 error. There are other situations involving ON SHUTDOWN which may show some of the same symptoms is DCOM isn't there.

DCOM can get put on a system in several ways; under WinNT, installation of SP3 or SP4 should add DCOM support, as would instllation of IE4. Win98 should always have DCOM support loaded unless by some quirk of fate IE4 misinistalled. Win95 systems can add DCOM by installing IE4, or by installing the support either from the DCOM95 version 1.2 support file (a self-extracting .EXE) or the DCOM98.EXE found on the Visual Studio distribution.

The C0000005 error only occurs if SCREEN=OFF and you subsequently make either the VFP main screen visible (_screen.visible = .t.) or activate a top-level form. You can detect that DCOM is missing and shut down before anything happens using the Registry class in the FFC and MESSAGEBOX() to display a message without making a form visible:
#INCLUDE REGISTRY.H
#DEFINE DCOMKEYSTRING 'SOFTWARE\Microsoft\OLE'
* Note change in line above to eliminate leading "\"
#DEFINE ENABLEDCOMKEY 'EnableDCOM'
SET CLASSLIB TO REGISTRY.VCX
oReg=CREATEOBJ('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 present on system. Please install it before running this application', ;
16, ;
'Missing Windows Component')
QUIT
ENDIF
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Reply
Map
View

Click here to load this message in the networking platform