Article ID: 193016 - Last Review: May 13, 2003 - Revision: 3.0

PRB: Error Compiling VB5 Project Using LPVOID in Type Library

This article was previously published under Q193016
Expand all | Collapse all

SYMPTOMS

While compiling a Visual Basic 5.0 project in Visual Basic 6.0, if the Visual Basic 5.0 project uses a type library that has a function that returns a LPVOID or a structure that contains a LPVOID field, the following error occurs:
Compile Error : Variable uses an Automation type not supported in Visual Basic

CAUSE

LPVOID is a Typedef to "void *." Visual Basic 6.0 is changed to explicitly prohibit the use of pointers in structures and as function return values.

RESOLUTION

Avoid using LPVOID as a field in a structure or as a return value in the type library. Instead, change them to type LONG respectively.

NOTE: Do not change the Typedef for LPVOID to LONG, because that would change the meaning of LPVOID in function parameters where it is valid and desirable.

STATUS

This behavior is by design.

APPLIES TO
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition
Keywords: 
kbprb KB193016
 

Article Translations