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

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020