Dec 072017
 
List of revisions to the new Visual Basic 3.0 Edition of the "Visual Basic Programmers Guide to the Window API" compiled by the author. In .RTF (Rich Text Format).
File APIBK.ZIP from The Programmer’s Corner in
Category BASIC Language
List of revisions to the new Visual Basic 3.0 Edition of the “Visual Basic Programmers Guide to the Window API” compiled by the author. In .RTF (Rich Text Format).
File Name File Size Zip Size Zip Type
APIBK.DOC 23621 8388 deflated
APIBK.RTF 26604 7423 deflated
TPCREAD.ME 199 165 deflated

Download File APIBK.ZIP Here

Contents of the APIBK.DOC file


-/@-FE\DZzZzzZzZzZzZzZZ
[
[
[
[
[&["
[H[Z[[[[[[[[[[[[[[[[4[O[zZ[[$(An open letter to all owners of PC Magazine's Visual Basic Programmer's Guide to the Windows API.

The release of Visual Basic 3.0 coincides with the release of the third printing of this book. It won't surprise you to know that this printing has been revised for the new release of VB. However, since the book is essentially a Windows SDK for Visual Basic programmers, the changes for version 3.0 were quite minor (this would not be the case had we been dealing with a major release of Windows).
In fact, the changes are so minor that it makes no sense for you to go out and buy a new copy of the book. Instead, as a public service and for the sake of good customer relations, this file contains a list of all of the changes and corrections that were incorporated into the third printing.
This file is based on the corrections as submitted to the publisher. I can't guarantee that they match the 3rd printing exactly (they will be proofing the text for grammer and spelling), but it should be close enough. On the other hand, because of lead times in the publication process, this document contains corrections that are not present in the 3rd printing (those corrections will also appear in the readme.txt file on the disk that comes with the second printing - so there is no need to pass this document on to people who have the 3rd printing).
This file may be distributed freely - please pass it around, post it on other BBS systems, etc.
Thanks to all of you who spotted errors in the book and forwarded them to me. Unfortunately, I did not keep track of who submitted suggestions and corrections, but off the top of my head I do remember Jonathan Zuck, Keith Pleas and Ted Young. To the others - I apologize for my forgetfulness (feel free to drop me a note and I'll be sure to mention you in the next set of changes).
Also, allow me to take this moment to encourage you to take a look at the SpyWorks-VB and CCF-Cursors demo program that comes on the book's disk. SpyWorks-VB is especially useful in conjunction with the book when it comes to taking advantage of advanced Windows API techniques.

Thank you for your support.

Daniel Appleman

Page xxiii
Header Visual Basic Compatibility has been renamed Visual Basic Version Compatibility
The last two paragraphs on the page have been replaced with the following text:
The orginal printing of this book was released for version 2.0 of Visual Basic. This edition has been revised as needed to be compatible with both Visual Basic 2.0 and Visual Basic 3.0. The changes were quite minor, owing to the fact that while Visual Basic changed, the underlying Windows API has not. All of the sample files and listings have been tested with Visual Basic 3.0, however they are still presented in version 2.0 format in order to ensure compatibility with both versions.
Some discussion of Visual Basic 1.0 has been left in this revision where appropriate. The listing for the RectPlay example in chapter 4 discusses how to interpret listings for version 1.0 if necessary.
Page xxiv
The following sentence is added after the first sentence in the Closing Notes section.
I never imagined that it would be as well received by the Visual Basic community as it has been.
Page 8, 2nd paragraph from the bottom, 4th line
Change C/C++ 7.0 to Visual C++
Page 23
Table 2.3, footnote #2
Change VB 2.0 implements... to VB 2.0 and later implements...
Page 24
In Sub Command1_Click:
Change For x% = 1 to 50 to For x% = 1 to 1000
This change still makes the same point, but the difference in performance will be more noticable than it would be with only 50 entries.
Page 41
The second line of code is:
If IsWindowVisible= -1 then ....
should be:
If IsWindowVisible(hWnd%) = -1 then ....
Page 45
Bottom paragraph, 3rd line.
Change 376836 to 6029316
Page 46
Table 3.4 should be changed as follows:
Determining Bit Values in a Number (Example &H805C0004) should beDetermining Bit Values in a Number (Example &H05C0004).
Change line 5 as follows:
5520-2322 and 21 should be5520-2322 and 20
Page 56
2nd paragraph from the bottom, 2nd line.
Change form of a Visual Basic 2.0 module... to form of a Visual Basic module....
Page 69
RectPlay Program Listings section, 2nd paragraph, first line, should be:
Program listings appear as saved in Visual Basic version 2.0 ASCII file format which is also compatible with Visual Basic version 3.0.
Page 70
2nd paragraph, 1st line
Change version 2.0 of Visual Basic to version 2.0 and 3.0 of Visual Basic
Page 80
Add the following entry to table 4.5
GetUpdateRect
Determines the portion of a window that needs to be updated

Page 137
SendMessage, SendMessageBynum and SendMessageBystring functions - VB Declarations section
SendMessage, SendMessageBynum and SendMessageBystring all return longs. Change the % sign at the end of each to &
SendMessageBynum and SendMessageBystring: Both should be aliased to "SendMessage", not "PostMessage".
Page 195
The correct declaration for SystemParametersInfoByval is:
Declare Function SystemParametersInfoByval% Lib "User" Alias "SystemParametersInfo" (ByVal uAction%, ByVal uParam%, ByVal lpvParam As Any, ByVal fuWinIni%)
Page 219
2nd paragraph from the bottom, 5th line.
Change ... of how many display pixels are in an inch is made ... to ... of how many display pixels are in a logical inch is made ...
Page 243
Add the following entry into the RASTERCAPS table entry:
RC_FLOODFILL: FloodFill API function is supported.
Page 268
In table 7.2 change GetObject to GetObjectAPI
(Note: The keyword GetObject became a reserved word in Visual Basic 3.0. In order to prevent conflict, the book and all sample and declaration files has been modified to use GetObjectAPI as an alias for the GetObject API function in much the way that SetFocusAPI is an alias for the SetFocus API function.)
Page 307
Change the declaration for GetObject to:
GetObjectAPI
Declare Function GetObjectAPI% Lib "GDI" Alias "GetObject" (ByVal hObject%, ByVal nCount%, ByVal lpObject&)
Page 320
In the "Use with VB" section for the SetROP2 function, nDrawMode parameter description, change the reference to table 7.9 to 7.8.
Listing 8.4 (page 341)
Last line on the page - change GetObject to GetObjectAPI
List 8.9 (pages 349 through 358)
Change all references to GetObject to GetObjectAPI.
Change all references to Update to DoUpdate (Update became a reserved word in VB 2.0 - the 1st printing disk was corrected, but it did not get into the book. This change can be found in the 1st printing readme.txt file).
The indentation in this listing does not match the conventions used in the other sample programs. How this happened is still somewhat of a mystery to me - but with luck it will be fixed for this printing.
Page 367
Change all references to shellapi.dll in the ExtractIcon function declaration and description to shell.dll.
Page 379
1st paragraph, delete the 3rd sentence and add:
You will learn how to create custom checkmarks for checked menus, and how to use any bitmap as a menu entry in place of a string. You will also learn how to customize floating popup menus that can appear anywhere on the screen.
Page 387
In the section Tracked Popup Menus delete the first sentence and add:
Visual Basic 3.0 provides direct support for floating popup menus to appear anywhere on the screen using the PopupMenu command. The TrackPopupMenu API function can also be used to create popup menus in cases where customization is required or for use with previous versions of Visual Basic.
Page 388
Insert a new subheading as follows:
Menus, System Menus and Subclassing
Subclassing is a technique which allows you to intercept Windows messages going to a form. This technique can be used to detect the WM_COMMAND Windows message directly, eliminating the need to ensure compatibility with a Visual Basic menu structure when using menu API functions. It also allows you to intercept the WM_SYSCOMMAND message which makes it practical to customize an application's system menu. Refer to the Message Handling section in chapter 17 for more information on subclassing and the tools required to use this powerful technique.
Listing 9.4 (pages 397-405)
Change all references to GetObject to GetObjectAPI.
Once again, the indentation does not consistantly follow Basic standards.
Page 397, function GetFlagString$
Change the 3rd through 4th lines in the function to the following:
If (menuflags% And MF_CHECKED) <>0 Thenf$ = f$ + "Checked"Elsef$ = f$ + "UnChecked"

Page 410, 412, 413,414
EnableMenuItem function - wIDEnableItem parameterGetMenuState - wID parameterGetMenuString - wIDItem parameterHiliteMenuItem - wIDHiliteItem paramater
In each of these cases, the first line says: "Identifier of the menu entry to check or uncheck". Modifiy this to match the description of each of these functions. This proves once and for all that the benifits of incorporating the "cut" and "Paste" operation into word processors is not without its drawbacks. Thanks to Ted Young for spotting this one.
Page 420
Use with VB section - add before the first sentence:
Visual Basic 3.0 provides direct support for tracked popup menus, however this function remains useful for customized menus and use with earlier versions of Visual Basic.
Listing 10.8
Change all references to GetObject to GetObjectAPI.
Listing 11.6
Change all references to GetObject to GetObjectAPI.
Page 545
Listing 12.4 heading should be: Project Listing File EXECDEMO.MAK
Listing 12.5 heading should be: Form Description for File EXECDEMO.FRM
Listing 12.6
Correct indentation for Sub File1_Click( )
Page 550
The first parameter for function FindExecutable should be lpszFile$, not lpszFile%.
The library declarations should be shell.dll not shellapi.dll.
Page 565
Change the library declaration for function ShellExecute to refer to function shell.dll instead of shellapi.dll.
Page 609
Under the Return Value section for the OpenFile function, the final sentence should read:
Errors are listed in Table 13.9 earlier in this chapter.
Page 610
The following table entry should be added to Tabel 13.12 before the OF_WRITE entry:
OF_VERIFY
Returns HFILE_ERROR if the time and date of the file specified by the lpFileName$ parameter does not match that specified by the lpReOpenBuff parameter.

Page 663
In table 15.1, change the second reference to CF_TEXT to CF_TIFF.
Chapter 16
Palettes seem to work the same under VB 2.0 and 3.0. The text was clarify to indicate this. Specifically - all indications of Visual Basic 2.0 have been changed to 2.0 & 3.0 as follows:
Page 691, par 2, line 3Page 697, par 2, line 3Page 698, section Using Palettee Functions with Visual Basic line 1Page 710, 2nd paragraph from the bottom, last line.Page 731, Function RealizePalette, Use with VB section line 1Page 733, Function SelectPalette, Use with VB section line 1Page 735, Function SelectPalette, Use with VB section line 1
Chapter 16, Function reference section
For the following functions: DrageAcceptFiles, DragFinish, DragQueryFile & DragQueryPoint change the declaration reference from "shellapi.dll" to "shell.dll".
Page 711
In section Dragging files, line1, change SHELLAPI.DLL to SHELL.DLL.
Page 765
Add the following Comments section to the WM_MENUSELECT command.
Comments:
When a menu is closed, wParam will be zero and the low word of lParam will be &Hffff.
Page 801
EM_GETPASSWORDCHAR function, Use with VB section. Change reference to Visual Basic 2.0 to be Visual Basic 2.0 & 3.0
Page 802
EM_LIMITTEXT function, Use with VB section. Change reference to Visual Basic 2.0 to be Visual Basic 2.0 & 3.0
Page 805
EM_SETPASSWORDCHAR function, Use with VB section. Change reference to Visual Basic 2.0 to be Visual Basic 2.0 & 3.0
Page 865
Use with VB section of agGetControlHwnd function. Change reference to Visual Basic 2.0 to Visual Basic 2.0 and later.
Page 870
Documentation is missing for the agVBSetControlFlags function.
agVBSetControlFlags
VB Declaration:
Declare Function agVBSetControlFlags& Lib "Apiguide.dll" (ctl As Control, ByVal mask&, ByVal value&)
Description:
This function is used to control the palette status of a control and returns the current status of the control.
Use with VB:
Can be used to specify or determine when a control is palette, and whether or not it currently owns a palette. In practice, this is only effective for determining status. You can use this function to set the palette awareness of a control only if you take over all aspects of selecting and realizing palettes. This requires a subclassing tool capable of detecting both the windows palette messages and the internal Visual Basic palette messages.
Parameters:
ctl - A control or form
mask - Set a bit in the mask to 1 to indicate that it should be chagned according to the value parameter.
value - Indicates the new value for the bits specified by the mask parameter.
Bit 0 is set to 1 to indicate that the control owns a palette.Bit 1 is set to 1 to indicate that the control is palette aware.
Returns Value - Long - A value describing the current state of the control.

Page 924
Change all references to shellapi.dll in functions DragAcceptFiles, DragFinish, DragQueryFile and DragQueryPoint to shell.dll.
Page 927
The first parameter for function FindExecutable should be lpszFile$, not lpszFile%.
Change the reference to shellapi.dll in functions ExtractIcon and FindExecutable to shell.dll.
Page 952
Change the reference to shellapi.dll in function ShellExecute and ShellExecuteBynum to shell.dll.
Page 933
Change the declaration of GetObject to:
GetObjectAPI7Declare Function GetObjectAPI% Lib "GDI" Alias "GetObject" ....
Page 988
Change BitBit to BitBlt
Page 1000
Change GetObject to GetObjectAPI
Page 1001
Add a reference to page 80 to function GetUpdateRect.
Page 1003
The following commands:
Istrcat, Istrcmp, Istrcmpi, Istrcpy, and Istrlen should be
lstrcat, lstrcmp, lstrcmpi, lstrcpy and lstrlen (lower case 'L' as the first character)
Page 1014
Change entry SHELLAPI.DLL to SHELL.DLL
Page 1015
Add the following references to the entry for subclassing: 388, 741-744.
Page 1020
Yep - part of the index is missing. Here are the missing entries:
WM_SYSKEYUP message, 777
WM_SYSTEMERROR message, 968
WM_TIMECHANGE message, 777-778
WM_TIMER message, 968
WM_UNDO message, 745, 778
WM_USER message, 968
WM_VKEYTOITEM message, 968
WM_VSCROLLCLIPBOARD message, 968
WM_VSCROLL message, 778-779
WM_WINDOWPOSCHANGED message, 779
WM_WINDOWPOSCHANGING message, 779-780
WM_WININICHANGE message, 780
WNDCLASS structure, 901-902
WndProc function, 862
WNetAddConnection function, 578, 617
WNetCancelConnection function, 578, 617
WNetGetConnection function, 578, 618
word breaks, 960
WriteComm function, 635, 659
WritePrivateProfileString functions, 570, 618
WriteProfileString functions, 570, 619
writing to files, 578, 602, 605, 610
WS_BORDER style bit, 102
WS_CAPTION style bit, 102
WS_CHILD style bit, 102
WS_CLIPCHILDREN style bit, 102
WS_CLIPSIBLINGS style bit, 102
WS_DISABLED style bit, 102
WS_DLGFRAME style bit, 102
WS_EX_ACCEPTFILES style bit, 103, 104
WS_EX_DLGMODALFRAME style bit, 104
WS_EX_NOPARENTNOTIFY style bit, 104
WS_EX_TOPMOST style bit, 104
WS_EX_TRANSPARENT style bit, 104
WS_GROUP style bit, 102
WS_HSCROLL style bit, 103
WS_MAXIMIZEBOX style bit, 103
WS_MAXIMIZE style bit, 103
WS_OVERLAPPED style bit, 103
WS_POPUP style bit, 103
WS_SYSMENU style bit, 103
WS_TABSTOP style bit, 103
WS_THICKFRAME style bit, 103
WS_VISIBLE style bit, 103
WS_VSCROLL style bit, 103
wvsprintf function, 715, 736-737
Xoff and Xon characters, 626
XOR bitmap, 333
Yield function, 956
zooming windows, 130
Z-order, 20

APICONST.TXT
The following constants were added:
'' SendMessage Flag
Global Const HWND_BROADCAST = -1
'' Network Connection errors
Global Const WN_NOT_CONNECTED = &H0030
Global Const WN_OPEN_FILES = &H0031
Global Const WN_BAD_NETNAME= &H0032
Global Const WN_BAD_LOCALNAME = &H0033
Global Const WN_ALREADY_CONNECTED= &H0034
Global Const WN_DEVICE_ERROR = &H0035
Global Const WN_CONNECTION_CLOSED= &H0036

Add the following after the ''SetWindowPos flags" section:
Global Const SWP_NOSENDCHANGING = &H400
Global Const SWP_DEFERERASE = &H2000

'' SetWindowPos() hwndInsertAfter values
Global Const HWND_TOP = 0
Global Const HWND_BOTTOM = 1
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
Apiguide.bas
Add the following declaration:
Declare Function agVBSetControlFlags& Lib "Apiguide.dll" (ctl As Control, ByVal mask&, ByVal value&)

Sample Code Changes
The following code changes are listed by file and line number. You may wish to also change the appropriate listing in the book. Other minor changes are listed in the update instructions earlier in this document.
GetObject
Visual Basic 3.0 uses GetObject as a reserved word. In order to accomodate this, the declaration for GetObject has been changed to GetObjectAPI which is aliased to GetObject. The new declaration of GetObject as seen in file apidecs.txt, apidecs.bas and in Appendix E page 933 is:
Declare Function GetObjectAPI% Lib "GDI" Alias "GetObject" (ByVal hObject%, ByVal nCount%, ByVal lpObject&)
The command GetObject must be changed to GetObjectAPI in the following files:
Menulook.frm, lines 285, 391
Puzzle.frm, line 77
Picprint.frm, line 335
Stockbms.frm, line 128
Textdemo.frm, line 116


prcmpi, Istrcpy, and Istrlen should be
lstrcat, lstrcmp, lstrcmpi, lstrcpy and lstrlen (lower case 'L' as the first character)
Page 1014
Change entry SHELLAPI.DLL to SHELL.DLL
Page 1015
Add the following references to the entry for subclassing: 388, 741-744.
Page 1020
Yep - part of the index is missing. Here are the missing entries:
WM_SYSKEYUP message, 777
WM_SYSTEMERROR message, 968
WM_TIMECHANGE message, 777-778
WM_TIMER message, 968
WM_UNDO message, 745, 778
WM

%
7
Y
b
k


'Xx&(/6\bfmov7JThjq68?no;LQ)26BXa
`ALaiz)1(CLP\x~>/;wajx "El!!!!!!/"P"""#$#1#K#N#i#p###%%%&&%&)&5&8&D&_&h&l&x&{&&&&&'''J'R'
bR'''''''''''A(J(V(b(c(o(())
**B*I*M*T*U*c*b++,,,,,-*-8-<-G-J-R-}-------G.O....../"/)/?/I//////0"[email protected]:5F5555555566$6U6^6a6k66666666

`667R7Z7c7i7m7s7~77777777777778888888899&9/999&;);O;R;u;x;;;;;;;<<'<*<>>]?i?3B?BBBCCCCCTE]EqE}EFF

Fv+
[

b
m

'Xx(/8Uox7jsB8Agv;l "]""""""""""""ADz)3*_>"Gl!!!/"R""""
##%%I%%&8&F&{&&&''J'T''''e(o(())c)n)$""""h""M"""M"]"""""]"An)*
**W*c* +,,J-T-----G.Q...A/K///C0M00001(111g3t333G4455!5556a6k6667R7\7u7777778D88888&919u99999"""""]"""""""l_`'*$E99:0:R:o:::::
;0;Y;;;;;<,/>H>c>~>>>>>?#?8?N?[?]?k?????
@[email protected]@@@@@A=AfAAAAAAB3BABaBBBBCCDHEE""M""%"""""PEEEEEFFF""
inserttextinserttext2B0

x
h
D
F5#+H389>D


M(R'6F$%&'n)9EF()*+,ZCG Times (W1)Symbol"Univers (W1)CG Times (WN)&ArialTimes New RomanBBB"hu%u%OModifications for 3rd printingDaniel ApplemanDaniel Appleman


 December 7, 2017  Add comments

Leave a Reply