PRB: hCtl May Be Invalidated by Visual BasicLast reviewed: October 30, 1995Article ID: Q129945 |
The information in this article applies to:
SYMPTOMSWith the release of Visual Basic version 4.0, developers of .DLL and .VBX file now need to ensure that they don't cache the hCtl of a Control passed as a parameter. Visual Basic can invalidate the hCtl at any time, without warning. Any DLL or VBX that caches the hCtl can encounter significant system problems such as general protection (GP) faults.
CAUSEIf a DLL or VBX exposes a procedure that takes a Control (As Control, As CommandButton, or AS SSCommandButton) as a parameter, and the DLL or VBX caches this parameter in a variable for use later as the hCtl in a call to the Visual Basic API, the DLL or VBX may get an error if it later attempts to reference the hCtl.
RESOLUTIONDLLs and VBXs can no longer cache the Control parameter in a variable and use this as the hCtl later in a call to the Visual Basic API. The control is actually being passed a pointer to an hCtl, and Visual Basic can invalidate that pointer at any time. There are two ways to solve this problem. The preferred method is to modify the DLL or VBX to correctly handle hCtl references.
STATUSThis behavior is by design.
|
Additional reference words: 4.00 vb4win vb4all
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |