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

Last reviewed: April 4, 1996
Article ID: Q149531
The information in this article applies to:
  • Professional and Enterprise Editions of Microsoft Visual Basic, 16-bit only, for Windows version 4.0

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.

WORKAROUND

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.


Additional reference words: 4.00 vb4win vb416 3.00
KBCategory: kbusage
KBSubcategory: tlscdk



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 4, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.