Home > Store

Visual C++ for Visual Basic Developers

Register your product to gain access to bonus material or receive a coupon.

Visual C++ for Visual Basic Developers


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2002
  • Dimensions: 7-3/8x9-1/8
  • Pages: 432
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-32218-8
  • ISBN-13: 978-0-672-32218-1

This book will concentrate on C++ and some C# techniques that will benefit Visual Basic programmers. The author's approach is to cover things that "feel good" in each language and where the languages can enhance each other, then the basics of C++, from a VB programmer's perspective, and finally COM and ActiveX programming in depth. This book should be more practical than most; much of the code shown will be shipping commercially and have a demonstrated application. There will be a great deal of source code, and will include controls and COM objects that can be directly adopted by the reader.


Source Code

Click below for Source Code related to this title:

Sample Content

Online Sample Chapter

C Programming for Visual Basic Lovers

Table of Contents


1. How Did We Get We Here?

A History of Visual Basic and C++.

16 Bit.

32 Bit.


Visual Basic's Contribution.

Strengths of Visual Basic.

Weaknesses of Visual Basic.

C++'s Contribution.

Strengths of C++.

Weaknesses of C++.


2. C Basics.

Tokens and Elements.





Predefined Constants and Macros.



Code Structure.


Scope and Visibility.




Invoking Functions.

main, wmain, DllMain.

Function Pointers.


3. C Programming.

Variables and Data.

Type Specifiers and Qualifiers.

Variables and Declarators.



Operators and Precedence.


Conversions and Type Casts.



Control and Flow.



4. C++ Basics.

Tokens and Elements.

C++ Keywords.


Constants and Literals.



Scope, Visibility, and Lifetime.




Variable Number of Parameters.


Variables and Data.

Runtime Type Information.

C++ Definitions and Declarations.

Variables and Declarators.






Error Handling.

C++ Exception Handling.

Structured Exception Handling.


5. C++ Classes.


OOP Concepts.

Basics of Classes.


Class Members.

Member Variables.

Member Functions.

Member Access Control.

friend Functions.

Derived Classes.


Multiple Base Classes.

Using Declaration.

Abstract Classes.


6. C++ and Windows.

How the Windows System Works.

Processes and Threads.

Message Subsystem.

How a Windows Program Works.

Window Class.

Creating a Main Window.

Base Services.



7. C DLLs.

Tutorial for Creating a Simple C DLL.

Using Visual C++ to Create the DLL.

Exporting the Function from C.

Prototyping the Function.

Writing the Function.

Starting Visual Basic from the C++ Environment.

Declaring and Using a Function from Visual Basic.

Debugging the C++ Code.

Tutorial Summary.

Passing Numeric Variables.

Four-Byte Integers (Longs).

Two-Byte Integers (Integer).

Four-byte Real (Single).

Eight-Byte Real (Double).



Using Strings.

Passing C Strings (ByVal).

Handling a BSTR.

Passing Byte Arrays.

Passing and Use Structures (UDTs).

Passing and Using Variants.

Pass and Using Arrays.

Unicode and ANSI 198Conclusion.

8. C DLL Practical Examples.

Type Libraries and DLLs.

Tutorial for Creating a DLL Including Type Library Information.

Some Finer Points of the IDL File.

Adding Resources to a DLL.

Samples of C DLLs.


Support of InstallShield.

Extended Stored Procedures.

Callbacks, Hooks, and Other Nasty Things.


9. Components and Controls.

Basics of Components.

Components and Inheritance.

Inheritance Defined.









Custom Controls.

Methods Used to Build Controls.

Visual Basic 5 and 6.


Visual Studio.NET.

ATL Controls in Detail.

Creating the Control Project.

Adding Properties.

Adding Methods.

Implementing Events.

Windows Message Maps.

Handling the Mouse.

Handling the Keyboard.

Property Pages.

Proper Property Persistence.

Enumerated Properties.

Categorizing Properties.

Returning Errors .

Safe for Initialization and Scripting.



Basing a Control on a Windows Control.

Composite Controls.

10. C# Basics.

The C# Type System.

Value Types in Action.

Reference Types.

Boxing and Unboxing.

Programming Concepts.















11. Applying C#.

C# WinForm Controls.

Creating the Control Project.

Coding the Control.

Control Elements.


Properties and Methods.


Design Time Support.



A. Definition of Terms.

B. Character Code Tables.

C. C/C++ Keywords.

Index. 0672322188T03282002


This book was written for intermediate to advanced Visual Basic programmers. It is not for advanced C and C++ programmers, although intermediate level C programmers might find the book beneficial. Many chapters would be tedious for someone who does not know Visual Basic, because of all the comparisons are drawn to Visual Basic code.

So now that I have the Visual Basic programmer's attention, I want to ask a simple question. Do you want to program in C, C++, or C#? Are these languages that you want on your tool belt? This question may be more difficult to answer than you might expect.

Why should you care about these languages? The short answer is that the C family of languages is the consummate choice of programmers who want to program without restrictions. You can think of anything you want to do in programming and there is a way to get it done in C, C++, and C#. There are very few language families that can make that claim. Given that, isn't C a language that you would like to know?

The longer answer has to do with the evolution of Basic and C. In the past, Visual Basic had definite advantages in designing user interfaces. It was much simpler to do in Visual Basic than in C or C++. Now, C# and Visual Basic (and a number of other languages, for that matter) use the same designer and share the same user interface design capabilities. The advantage has slipped away from Visual Basic in this department.

Visual Basic had some other qualities that made it easier to develop and use end user programs, especially for fairly inexperienced programmers. This advantage has slipped away too. The latest Visual Basic is a magnitude more complicated than previous versions and much harder to get your arms around. Moving to the latest Visual Basic language from Visual Basic 6 may be just as difficult as making the move to C#.

Microsoft says choosing a language is a lifestyle choice now. I think the choice carries more implications than that. C has always been the internal development language at Microsoft--well, C or a derivative of C. First was C, then C++, and now C# is being used extensively at Microsoft. What affect does this have on the language? Just the effect you might expect. If a Microsoft programmer needs a feature in C, C++, or C# to get his job done, he or she typically gets that feature. So now you are faced with a situation where C# is actually more capable than Visual Basic but, because of the designer, it's just as easy to use.

For example, C# can be used to write unmanaged code; Visual Basic cannot. C# can override operators; Visual Basic cannot. C# can access memory directly; Visual Basic cannot. We could go on with this list and we will later, but the point I want to make now is that Microsoft uses C# as the premier development language in the .NET technologies.

Am I advocating that you switch to C# now? I am advocating that you learn a language that is and has been at the top of this game for many years. This book will concentrate on components and about the differences in Visual Basic and C. I will show you how to write routines and objects that you can use to augment your Visual Basic skills. At the same time, there is enough information in this book to shift to C# completely if you want. My main point remains that you will want to know enough about these languages to augment your Visual Basic skills. If you decide to shift to the C family altogether, this is a good way to begin your transition.

The following summary should introduce you to the main aspects of this book.

  • Chapter 1: "How Did We Get Here?"--This chapter will take you on a short history lesson. If you've been in Visual Basic from the start, it may be a review for you. I think, however, that it is good to know where you came from, so you can better understand where you are going.
  • Chapter 2: "C Basics"--This chapter talks about "bare" C (C language without the C++ extensions), how the language is structured, and the differences between C and Basic code. Samples will be used to demonstrate the differences. This chapter will be a basis for both C++ and C#, because both of these languages are built on the C concept.
  • Chapter 3: "C Programming"--This chapter continues the discussion on bare C programming. This chapter lays the foundation for understanding variable types in C and C++. It also covers common programming constructs in C, such as decisions and
  • looping.
  • Chapter 4: "C++ Basics"--This chapter will talk about C++ and the basic differences between C and C++. The C++ compiler added features to the language that are not necessarily directly related to classes. We'll cover those changes and prepare you for understanding C++ classes.
  • Chapter 5: "C++ Classes"--This chapter focuses on C++ classes. C++ classes are the most common way for a programmer to get introduced to implementation inheritance, and we'll spend a little time understanding this. Inheritance is something that you'll want to understand if you intend to program in C++ or C# technologies.
  • Chapter 6: "C++ and Windows"--This chapter is an introduction to the underlying components in a WIN32 program and contains some sample C code that shows how to interact with those components. If you intend to do much work in C or C++ in WIN32, these basics are good to know.
  • Chapter 7: "C DLL Basics"--This chapter will take you back a little bit to an older, but still useful technology, a function-based DLL. Many of the features that more modern technologies rely on are implemented in simple DLLs. You'll learn how to write them in this chapter. This chapter also covers basic type conversions between Visual Basic and C.
  • Chapter 8: "C DLL Practical Examples"--This chapter contains the samples for the preceding C DLL chapter. It includes samples on subclassing and callbacks. It also provides a discussion about using a type library to simplify access to your DLL.
  • Chapter 9: "Components and Controls"--This chapter talks briefly about creating components in different technologies. It discusses the differences between COM technologies and .NET technologies. Then it moves into control technology in depth. It addresses ActiveX control development in detail.
  • Chapter 10: "C# Basics"--This chapter will lead you through the differences of the most modern language offerings from Microsoft. We'll discuss the basics of C#. C# was designed from the ground up to do the job that Microsoft has outlined for the .NET technologies and will likely become the premier MS development language.
  • Chapter 11: "Applying C#"--In this last chapter, you'll take a deeper look into C# and build a component with it. We'll demonstrate some of the practical differences between C# and the previous development languages.

If you've been thinking about learning to program in C, now is the time to start the journey. You have a steep hill to climb moving from Visual Basic to .NET technologies, and it just might afford you the opportunity to expand your language choice.



Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership