Win32 API Programming with Visual Basic by Steven Roman Unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. If you have any technical questions or error reports, you can send them to booktech@oreilly.com. (Please specify the printing date of your copy.) This page was updated August 21, 2002. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification UNCONFIRMED errors and comments from readers: {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. [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. {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. [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? {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. [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. (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. (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. {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) [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. {184} 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 [201] The code at the top of the page is missing from the CD. Instead, the CD files \Code_ThreadSync\ThreadSync1.bas and \Code_ThreadSync\ThreadSync2.bas are identical. (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) {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] [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. (450) The second line of code on the page now reads: Comctrl32.dll: File Version... It should read: Comctl32.dll: File Version...