Microsoft KB Archive/149531

= CDK 16-Bit OCX Loaded in Memory on Windows Exit Hangs Machine =

Article ID: 149531

Article Last Modified on 1/8/2003

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition

-



This article was previously published under Q149531



SYMPTOMS
If you have any .OCX, .VBX, or .DLL that was created by the Control Developer's Kit (CDK) loaded in memory when you exit Windows 3.1, Windows will hang trying to call the WEP in the .OCX.

Visual Basic 3.0 or 4.0 (16-bit) application contains a control created by the CDK (for example, CIRC3). When the application is still running, and you exit Windows 3.1, the system hangs.



CAUSE
The cause of this hanging is that the CDK-provided WEP calls into other .DLLs. During Windows shutdown, those .DLLs may have already been unloaded.



STATUS
Microsoft has confirmed this to be a problem in the 16-bit version of the Control Development Kit.



RESOLUTION
The solution is for the control to implement a custom WEP and only call the CDK's WEP when Windows isn't shutting down. In the case where Windows is shutting down, the control's custom WEP shouldn't do anything.

The following code may be used as a control's custom WEP procedure. Place these statements in the main .CPP file of the control. For example, CIRC3.CPP. extern "C" int CALLBACK WEP(int);

extern "C" int CALLBACK CTLWEP(int nExitType) {     if (nExitType == WEP_SYSTEM_EXIT) return 0;

return WEP(nExitType); } In the 16-bit .DEF file (for example, CIRC3.DEF), change the following line WEP                @1  RESIDENTNAME to: WEP=CTLWEP         @1  RESIDENTNAME



MORE INFORMATION
This is a problem with how the CDK has implemented their WEP. For end users, this will happen if they try to exit Windows with an application that has a CDK .OCX, .VBX, or .DLL loaded.

Keywords: KB149531

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.