Products Purchase Publishing Articles Support Company Contact |
Products > Books > COM > Win32 API Puzzle Book and Tutorial > Introduction |
|||||||
Visual Basic Programmer's Guide to the Win32 API Introduction Contents Updates Edition History Exploring VB6 (series) Developing COM/ActiveX Components with VB6: A Guide to the Perplexed Introduction Outline What's New from the VB 5.0 edition Updates Win32 API Puzzle Book and Tutorial Introduction Chapter Outline Sample Puzzle Updates NT Security Programming with Visual Basic 6 Updates Visual Basic Programmer's Guide to the Windows 16 bit API
|
Note: This page describes a legacy product or book. The page is available for archival purposes and as a courtesy to those who have linked to it, but is no longer being updated or maintained.
Win32 API Puzzle Book and Tutorial
|
|
Many of you have heard of my best selling book "Dan Appleman's Visual Basic Programmer's Guide to the Win32 API". A book designed to teach Visual Basic programmers how to use the Win32 API - the functions that make up the Windows operating system. The book does a good job at teaching VB programmers the fundamentals of Windows, and how API functions are declared and called. It also includes a reference for about 800 of the "core" Win32 API functions.
However, at last count there are over 8500 API functions in Windows. By conservative estimate, if I was to do a decent job covering these functions it would take me 12 volumes and 9 years to write - by which time it would be hopelessly obsolete.
So what is a Visual Basic programmer to do if they need to use one of those thousands of functions in the dozens of specialized subsystems that make up today's complex Windows operating systems?
Clearly there is only one solution - Visual Basic programmers must learn to read the Microsoft documentation and translate it to Visual Basic on their own. And while it's true that my Win32 API guide book does teach VB programmers how to do this, the information is scattered widely throughout the book, and is not sufficient for some of the more complicated declarations.
Clearly something else was needed.
My new book "Dan Appleman's Win32 API Puzzle book and Tutorials for Visual Basic" from APress (ISBN: 1-893115-01-1) is my attempt to address the problem.
A Different Approach
When I started working on this book, two things were clear: First, that the book would have to have the most in-depth set of tutorials yet written on the subject of how API functions are called from Visual Basic. Second, that the book would have to be designed to force readers to think about the process of reading the Microsoft documentation and creating their own declarations. It would also have to give them the opportunity to debug the inevitable problems that occur.
How does one accomplish this?
I thought of all of the technical books that I've ever read, and suddenly remembered a book called "The C Puzzle Book" by Alan Feuer.. This book consisted of little more than some of the most devious and sneaky puzzles I had ever seen that illustrated complex C language constructs. It encouraged readers to solve the problems on their own before looking at the solution. It encouraged readers to think. Any reader who really worked their way through the book could end up a true expert on the C language.
I was inspired to take the same approach with this book.
In this book you will find 32 puzzles. Most of them are very similar to the one that you are about to read (which is not included in the book, but was instead created to demonstrate what the book is like). The puzzles increase in complexity from a level that most VB programmers will be able to solve easily, to those that should provide hours of fun and frustration even for the experts. This demo puzzle falls somewhere in between these two extremes.
This book also includes 12 tutorials that cover every aspect of declaring and calling Win32 API functions from Visual Basic. You'll read about how different types of variables are actually stored in memory, and how they are passed as parameters to API functions. You'll learn about stack frames, and the differences between various types of strings from fixed strings, to dynamic strings to null terminated Unicode or ANSI strings, to BSTR (OLE) strings. You'll read case histories that demonstrate the entire process of figuring out how to declare and use complex API functions. The tutorials are designed to give you all the knowledge necessary to solve the puzzles.
Obtaining Process Memory Information
How did I go about choosing puzzles to include in the book? You might think that I would take working code and break it - adding mistakes for readers to solve. But this is not the case. Most of the puzzles started out with real questions from readers of my API guide book. For example: the following question came in from a reader who wanted to obtain memory information about a process: