Windows API Declare Book version 3.0 released

Version 3.0 (Dec 2018) of the Windows API Declare Book has been released and it contains many added examples and updates.

The goals of this major update are:

  1. Minimize the use of Aliases
  2. Make all examples compatible with ANSI, Unicode, 32-bit, adn 64-bit computers. There were a few requests to support some old Windows XP machines.
  3. Many functions were added to support the ANSI and new examples included in the book
  4. Added the functions and methods to a module for easier portability across Windows Operating System platforms
  5. Added many more constants
  6. Added lots of structures
  7. Finished adding more native Windows controls
  8. Added many Target Windows conditional statements to prevent Windows specific code to run on other Operating Systems
  9. All examples work in Xojo 2018 R3
  10. Removed ByVal prefixes as this is the default setting
  11. Cleaned up code to be easier understood
  12. Added 30 new examples
  13. Over 66 updates
  14. Standardized the writing of declare methods
  15. More API declares were added

All of the previous screen grabs showing ChooseColor, playing a video, and playing an audio file are also ANSI, Unicode, 32-bit, and 64-bit are supported.

The API Windows calendar control was added:

Controlling the native Windows API keyboard was added:

…and many other controls were added.

This is a new book that is over 900 pages with more than 140 example programs in 25 chapters. The low price of $14.99 has been set to make this book available for programmers to learn advanced API programming.

This is a PDF formatted document and all examples include Xojo code. The Table of Contents can be viewed at Http://scispec.ca

ISBN: 978-1-927924-10-5

Some of the new additions to the book are:

  1. Added new CheckBox API example (Example 6-13) that is ANSI, Unicode, 32-bit and 64-bit compatible
  2. PDF Bookmarks have been added to make topic browsing easier
  3. Added LCID data type conversion in Appendix A
  4. Added Example 25-1: On-Screen Keyboard, ANSI, Unicode, 32-bit, and 64-bit compatible
  5. Added Example 25-2: Move On-Screen Keyboard, ANSI, Unicode, 32-bit, and 64-bit compatible
  6. Added Example 23-5: PRINTER_INFO_2 with ANSI and Unicode DEV_MODE structures: Compatible with ANSI, Unicode, 32-bit, and 64-bit programs
  7. Added Example 23-6: PRINTER_INFO_1 with compatibility for ANSI, Unicode, 32-bit, and 64-bit projects
  8. Added Example 4-11: GetFileInfo, compatible with ANSI, Unicode, 32-bit and 64-bit projects
  9. Added GetSysColorBrush for hbrBackground Window refresh (Example 6-12) that is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  10. Add a CheckBox API control (Example 6-13) that is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  11. Added Static control window class styles (Appendix AP) constants
  12. Added the ability to show a static image (Example 6-14) that is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  13. Added Static control messages in Appendix AQ
  14. Added ICC Control Class Constants (used in Example 6-15) shown in Appendix AR
  15. Added Trackbar message constants shown in Appendix AS
  16. Added month control style constants in Appendix AT
  17. Added Calendar control message constants in Appendix AU
  18. Added Calendar notification codes in Appendix AV
  19. Added API calendar control (Example 6-16) that is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  20. Added snippet to populate a Structure from a memory address (Example 24-8)
  21. Added GetMBFromAddress method (Example 24-9)
  22. Added Tooltip control in Example 6-17 which is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  23. Added an UpDown control in Example 6-18 which is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  24. Added a GroupBox and Radio buttons example that is compatible with ANSI, Unicode, 32-bit and 64-bit projects (Example 6-19)
  25. Added a ComboBox example which is ompatible with ANSI, Unicode, 32-bit and 64-bit projects (Example 6-20)
  26. Added a Tab Control in Example 6-21 which is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  27. Added a Listbox Control in Example 6-22 which is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  28. Added a Bezier drawing example in Example 7-6 which is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  29. Added PointsArrayToMB in Example 24-11 which is compatible with ANSI, Unicode, 32-bit and 64-bit projects
  30. Added TOKEN_PRIVILEGES structure, OpenProcessToken function, LUID_AND_ATTRIBUTES structure, LUID structure, LookupPrivilegeValue function, and AdjustTokenPrivileges function to Example 9-1 which are compatible with ANSI, Unicode, 32-bit and 64-bit projects

Some of the updates added to the book are:

  1. Updated Example 3-3: GetWindow, FindWindow, and GetWindowText functions for ANSI and Unicode
  2. Updated Example 5-1: GetWindow, FindWindow, and GetWindowText functions for ANSI and Unicode
  3. Updated Example 5-4: GetWindowText functions for ANSI and Unicode
  4. MAX_PATH constant is 260 on ANSI and 520 with Unicode (Example 4-11)
  5. Fixed grammatical and spelling mistakes
  6. Updated Example 2-2 GetVersionInformation for ANSI, Unicode, 32-bit, and 64-bit compatibility, and added functionality.
  7. Updated Example 2-3 to also be compatible with ANSI and Unicode for 32-bit and 64-bit systems.
  8. Updated Example 2-5 for ANSI, Unicode, 32-bit, and 64-bit compatibility
  9. Modified GetSysColor function (Example 2-6) for ANSI, Unicode, 32-bit, and 64-bit compatibility
  10. Updated GetLocaleInfo (Example 2-7) for ANSI, Unicode, 32-bit, and 64-bit compatibility
  11. Added SYSTEMTIME structure in Example 2-8 for GetLocalTime
  12. Added compatibilility for ANSI and Unicode API calls for GetUserName (Example 2-9)
  13. Added Wow64 compatiblity for Example 2-10 and the calls are now automatically peformed
  14. Updated Example 3-2 to be compatible with both Unicode and ANSI GetModuleFileName API calls in 32-bit and 64-bit.
  15. Updated Example 3-1 to be compatible with both Unicode and ANSI GetWindowLongPtr API calls in 32-bit and 64-bit.
  16. GetWindowLong example 3-1 is not a preferred method for 64-bit executables
  17. Updated GetDiskFreeSpace (Example 4-1) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems
  18. Updated GetFileAttributes (Example 4-2) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems
  19. Updated CreateDirectory, CreateFile, WriteFile, CloseHandle, and DeleteFile API calls (Example 4-3) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems
  20. Updated CopyFile API calls (Example 4-4) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems
  21. Changed Example 4-7 to use the proper UInt64 datatype
  22. Updated SHQueryRecycleBin API calls (Example 4-8) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems. Added functional SHQueryRBInfo structure.
  23. Updated GetVolumneInformation API calls (Example 4-9) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems. Added GetVolumeInfo structure, and GetVolumeInfo file flags.
  24. Updated FindFirstFile and FindNextFile API calls (Example 4-10) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems. Modified StringWidth to be compatible with Xojo 2018 R3.
  25. Corrected GetClassInfoExW and GetClassInfoExA structures, along with adding GetClassInfoEx_ClassStyle bit flag checking method for Example 5-3 which is compatible with ANSI, Unicode, 32-bit, and 64-bit systems. Also changed data display from a label to a TextArea control.
  26. Updated SHQueryRecycleBin API calls (Example 4-8) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems. Added functional SHQueryRBInfo structure.
  27. Updated GetForegroundWindow, GetWindowText, and GetWindowTextLength API calls (Example 5-4) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  28. Updated FlashWindow API call (Example 5-5) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  29. Updated GetKeyboardLayout API call (Example 5-6) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  30. Updated SetLayeredWindowAttributes and SetWindowLongPtr with SetWindowLong API calls (Example 5-7) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  31. Updated MoveWindow API call with proper data types in Example 5-8.
  32. Updated Example 2-4 with Xojo GetSystemMetrics method with API call.
  33. Many changes to create a Windows API simple window example (Example 6-1) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  34. Updated the common window example (Example 6-2) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  35. Updated the left-mouse-click example (Example 6-3) to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  36. Updated Cursors (Example 6-4) with APIÂ’s for LoadCursor, SetCursor, Constants, and required updates to RegisterClassExA and RegisterClassExW that effects all other examples in Chapter 6. Now ANSI, Unicode, 32-bit, and 64-bit compatible.
  37. Updated Menu creation (Example 6-5) with LoadCursor, Including a menu name, AppendMenu, SetMenu, and DestroyMenu API calls. Compatible with all Windows systems.
  38. Updated Add Buttons Example 6-6 to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  39. Updated Create a Label Example 6-7 with updated SetWindowText method. Compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  40. Updated Create a TextBox Example 6-8 to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  41. Updated APIMessageBox Example 6-9 to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems.
  42. Updated screen grab for Example 2-11.
  43. Removed WString and CString from tagWNDCLASSEXA and tagWNDCLASSEXW to Ptr, which made window creation stable.
  44. Updated drawing text to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 7-1.
  45. Updated drawing a line to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 7-2.
  46. Updated drawing a rectangle and ellipse to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 7-3.
  47. Updated drawing with pens to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 7-4.
  48. Updated drawing with a brush to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 7-5.
  49. Updated drawing with pictures be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 8-1.
  50. Updated mask picture drawing to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 8-2.
  51. Updated drawing a mask at runtime with pictures be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 8-3.
  52. Updated getting a Screen Grab to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 8-4.
  53. Updated Example 9-2 with a more-compatible SetSuspendState method.
  54. Update code from Example 11-1 from legacy AbsolutePath to NativePath
  55. Updated ShellExecute code from Example 13-1 to be compatible with both ANSI and Unicode on 32-bit and 64-bit systems.
  56. Updated Example 14-1 with a new GetKeyState method and Declaration
  57. Updated Example 14-2 with new GetAsyncKeyState Method and Declaration
  58. Updated API colour picker to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 15-1.
  59. Updated mciSendString A and W functions for Example 16-1, 16-2, 16-3, 16-4 to be compatible with ANSI, Unicode, 32-bit, and 64-bit.
  60. Updated QueryPerformanceCounter and QueryPerformanceFrequency with proper data types and made drag-and-drop methods for portability (Examples 17-1 and 17-2)
  61. Updated CopyMemoryRead, CopyMemoryWrite, GetProcessHeap, HeapAlloc, and HeapFree with proper data types and made drag-and-drop methods for portability (Examples 18-1)
  62. Updated API DisplayDevice to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 19-1.
  63. Created workaround for Rectangle structure incompatibility issue to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems in Example 19-2.
  64. Updated data types in Example 20-1
  65. Updated Example 20-2 to be compatible with ANSI, Unicode, 32-bit, and 64-bit systems
  66. Updated Example 10-1 to be compatible with ANSI, Unicode, 32-bit and 64-bit projects
1 Like

Hrmph! You make the rest of us look like we’re slacking off :stuck_out_tongue:

:smiley:

1 Like

LOL, I just wish that I knew half of what you do Tim :slight_smile:

Couldn’t resist. Is this the name of an upcoming book?

Chuckle, this would be the name of an encyclopaedia :slight_smile:

Eugene, I don’t need this book right now, but it’s a very good idea, and I wanted to take this opportunity to congratulate you and thank you for all your work! I had bought your book on JSON and it was very clear, very effective. I noted to buy more books.

I often think of you when I work with MBS plugins. Christian does a fabulous job for the community, he is very reliable and has been for a long time. But the documentation of its plugins is often discouraging, while some are almost indispensable.

In short, I encourage you to study the idea of writing one or more books about these plugins, especially the most used ones. For example, a book on MBScurl or MBSdynaPDF would be excellent and would be very successful I think! Anyway, I’ll buy them immediately!

Translated with www.DeepL.com/Translator

Thank you for the comment Olivier. I am going to start a new conversation to allow others to talk about it.
Here is a link to the new topic:

Writing books for third party plugins

Got it! A little “light reading” for the upcoming weekend. :slight_smile: My MacBook just got a little heavier just now I think.

Finally something decent to read in a Macbook :wink:

Thanks for the votes of confidence :). Personally, I wish I could REMEMBER half of what I know.

I gotta ask… is this update available for previous 2.x owners or do we need to buy the new version separately.
I just want to know if I should wait a bit longer for an email with the download link to the update or go straight ahead and buy the new one.
Thanks for the great book!

HI Gabriel,

Version 3.0 will need to be purchased separately and is not an update to versions 2.x of the book.

I am glad to hear you have enjoyed the books!

Thanks @Eugene Dakin .

1 Like

Your website link https://scispec.ca/images/WordSep2016ToC.pdf leads to an error page.

Thank you Amy. I will see what’s wrong when I am near a computer later tonight. :slightly_smiling_face:

1 Like

Hi Amy,

Thanks for letting me know about the link. I updated the book and forgot to update the link. Here is the updated link to the Table of Contents for Microsoft Word.

2016 Word Book

:slight_smile:

Edit: Corrected spelling.