Errata

Win32 API Programming with Visual Basic

Errata for Win32 API Programming with Visual Basic

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 30
1st declaration example

Since I'm new at this I only think this is an error. Case 3 where it talks
about passing by reference, the declaration is renamed
rpiAddOneByRefAsInteger but the parameter Var is still passed ByVal.

Anonymous   
Printed Page 39
In the code section, which begins on page 38 and ends on page 39

The function is called GetAPIErrorText. However, the code on page 39 refers in
the function body's assignments to GetErrorText. I think the compiler would
choke on the undeclared/dimensioned GetErrorText "variable" (assuming option
explicit is set), and certainly it will get upset by the nonreturning of a
value from a function.

Anonymous   
Printed Page 50
the author discusses the use of the C++ sizeof operator.

In his discussion he states: "Using the sizeof operator
to indicate the number of bits that a data type consumes in memory..."

The following section goes on to demonstrate how sizeof(short) returns 16,
sizeof(int) returns 16.

According to my experience (and the help pages) the sizeof operator
actually returns the number of bytes of memory that it takes to construct a
variable, structure, object, etc..

I believe these examples are incorrect. You should probably fix these in
the next edition (if any) of the book.

Anonymous   
Printed Page 59

The 4th bulleted item says "A Double variable is located at a memory address that is a multiple of 8" when referring to aligning members of a
structure (user-defined type). At
http://support.microsoft.com/support/kb/articles/Q171/5/83.ASP, there is a
table that lists a double to be aligned on a boundary that is a multiple of 4.
When I pass a VB6 user-defined type to a Micro Focus COBOL dll, I have to
align a double (comp-2 COBOL data item) on a boundary divisible by 4, not 8.
Am I missing something, or it the statement in the book incorrect?

Anonymous   
Printed Page 98
- code sample

The code sample aims to show that a BSTR's contents (StrPtr) are changed in
the call to GetWindowText. Code snippet is:

cTitle = GetWindowText(hnd, sText, 255)
sText = Left$(sText, cTitle)
Debug.Print sText
Debug.Print VarPtr(sText), lngV
Debug.Print StrPtr(sText), lngS

Problem: I believe the Left$ function is changing the BSTR contents, not
GetWindowText. If we put the Left$ function after the Debug.Prints instead
of before, the pointers returned from the API match the values prior to the
call.

Anonymous   
Printed Page 104
the starting paragraph

The starting paragraph reads:

Under Window NT, the WatchOut function changes the
original BSTR poiter(instead of an ANSI copy),...

But, the author says:

Under Windows NT, BSTR to ABSTR translations occur
always when VB strings are passed to external functions
as parameters.

If this is correct, under Windows NT, changed pointer would be ABSTR's, not
BSTR's, like Windows 9X.

Anonymous   
Printed Page 113

In the GetMenuItemInfo call, we pass in hSubMenu as the first argument in the call. This won't compile because it's not declared anywhere and it's
not a parameter to GetMenuInfoExample(), either. We have the same problem on
page 115.

Anonymous   
Printed Page 119
first sentence, top of page

Here the parameters are an LPSTR ...

Should this read LPTSTR? Or perhaps, "In the ANSI case, we can consider their
parameters as an LPSTR and a pointer to a DWORD ..."? I understand based on
the VB declaration following this sentence that we're talking about the ANSI
case GetComputerNameA(), but there is a GetComputerNameW() and the VC
declaration is LPTSTR. We should let the user know we're going to pick ANSI
here and why.

Anonymous   
Printed Page 119
In the middle of page in the fourth code listing starting with the line

"Public Function GetTheComputerName As String," the second-to-last line of
this function defination reads:

GetComputerName = Trim0(s)

It should read:

GetTheComputerName = Trim0(s)

Anonymous   
Printed Page 179
entire section of "Is This Application Already Running?":

I'm surprised that in this section the author made no mention of the VB
App.PrevInstance property that seems to be the simplest method of detecting
whether the application is already running. It has its downsides, but I
thought it deserved a mention.

Anonymous   
Printed Page 184
last section of code on the page

In the last section of code on the page (the declare statements for the functions defined in the VC++ dll code), the last declaration is
incorrect. It now reads:

Declare Function rpiSetUsageCount Lib "rpiUsageCount.dll" () as Long

it should read:

Declare Function rpiSetUsageCount Lib "rpiUsageCount.dll" (lNewCount as
Long) as Long

Anonymous   
Printed Page 201
code at the top of the page

The code at the top of the page is missing from the CD. Instead, the CD files Code_ThreadSyncThreadSync1.bas and Code_ThreadSyncThreadSync2.bas
are identical.

Anonymous   
Printed Page 202
In the 6th paragraph, the phrase

...(pick up the baton) that is already owned (nonsigned)

should read:

...(pick up the baton) that is already owned (nonsignaled)

Anonymous   
Printed Page 265
In the code sample that begins on the middle of the page, the function

"def DataSetsFromDicts(dict_list, key_list=None):" mistakenly modifies first
element of dict_list if key_list is omitted.

While a single dictionary element with {'Name':'BoxHill' ...} passed to this
function, comparison.pp() prints out two elements ('BoxHill', None, 2).

Probably in accompanying source code, the function DataSetsFromDicts from the
laundry.py module should have the line:

all_key_dict = dictlist[0].copy()

instead of:

all_key_dict = dictlist[0]

Anonymous   
Printed Page 295
In Example 16-2, the Control Extractor Application does not work on a

Windows 95 machine. The number of entries in the list box is correctly
reported, but the destination list box gets filled with blanks instead of the
source list box test. A possible source of error is in the call to
SendMessageByString.

[336 (CD)] The last sentence of the first paragraph under the
rpiGlobalHook.dll heading states that source code for the rpiGlobalHook.dll
"is also on the accompanying CD." I scanned the CD accompanying the book and
found no reference to any .cpp files. Was the source code deliberately
omitted from the CD? One reason I'm interested in the source code is because
I'd like to be able to single-step through the DLLs referenced in the
following chapter; my reason for this is to see if I can determine why memory
is being corrupted when the functions contained in them are executed.

Anonymous   
Printed Page 450
The second line of code on the page now reads

Comctrl32.dll: File Version...

It should read:

Comctl32.dll: File Version...

Anonymous