Extending Visual Basic with C++ DLLs

Bruce McKinney
Microsoft Press

April 1996

Bruce McKinney was a factory assembly worker, a logger, a newspaper reporter, a PR flunky, and an unpublished fiction writer before he discovered computers and lost all interest in the real world. During his 10 years at Microsoft, he has written programming manuals and online help for assembly language, Basic, and C. Bruce also served for a time as czar of sample programs, writing or revising many of the samples known to long-time Microsoft language customers. He was a software developer on two Microsoft products:  C7 and the FORTRAN compiler. He holds a journalism degree from the University of Washington and a computer science degree from the University of Hard Knocks. Bruce is author of Hardcore Visual Basic (Microsoft Press, 1995). He can be reached at brucem_MS@msn.com. The Web site for his book is: http://www.microsoft.com/mspress/brucem/hardcore.htm.

Contents

Click to view or copy the sample files for the CPP4VB sample application

The articles in this series were originally intended to be chapters in a book. They are presented here in article form in hopes that you will find them useful and/or thought-provoking.

Introduction
Where I'm Coming From
The Tools You Need
What You Need to Know

Article 1. Stealing Code with Type Libraries
The Win32 Type Library
The Object Description Language
Parameter Types
All About Constants
Type Library Help Files

Article 2. Libraries Made Too Easy
The Three Levels of DLL Programming
The Mechanics of Building DLLs
The OLE Types
Using Simple Types

Article 3. Strings the OLE Way
Introduction
Unicode vs. ANSI
What Is a BSTR?
The String Class

Article 4. The Ultimate Data Type
What Is a VARIANT?
The Variant Class

Article 5. The Safe OLE Way of Handling Arrays
What Is a SAFEARRAY?
The SafeArray Class
What's Next?