Windows Declares Book - Updated to Xojo API2

The large and famous Windows Declare Book has been updated to the new Xojo:API2 code that is now revision 4.0 and used Xojo 2019 R3.1.

Xojo is a nice general-purpose programming language, and additional features, functionality is available through Declares that tap-into the advanced aspects of programming are available.

This book provides many examples that are converted from C++ functions to Xojo. Although there are many Visual Basic examples that can be converted, vb declare example are becoming outdated, have different parameters, or contain misinformation. For these reasons converting from C++ to Xojo is a long-lasting alternative and which this book provides many descriptions, reasons, references, and working examples for Xojo declares.

There are 31 chapters and contains over 1050 pages with over 150 example programs.

The ebook is a pdf formatted document and all examples include Xojo code. Further information is available at https://scispec.ca

This is one of the many available books at Xojo Library where many Xojo resources are available.

ISBN: 978-1-927924-10-5

A list of some of the many changes in this book are partially shown below:

New to Version 4.0 – May 2020

Begin task of updating all examples to Xojo API2
Updated many screen grabs for example programs, and updated to Windows 10
All Analyze Code switches for API2 have been turned on
Change Example1-1 to use Value instead of Text
Update Microsoft Docs reference for C++ Beep function
Change Example1-2 to use Value instead of Text
Change the DWORD value to use a UInt32
Update Example1-3 to use API2 version of a double by adding a decimal point
Update Example1-4 to use Value instead of Text
Updated Example1-5 byte for space to be 32 instead of 65535 for CString
Updated Example 1-6 to Xojo API2, Value instead of text, and Memoryblock change
Added newer version to check IsUnicode for newer OS Unicode compatibility
Updated Example 1-7 to API code version 2 in Xojo
Changed Screen grab and updated old Text to Value code in Example 1-8
Updated Example 1-12 to API2 code and updated Microsoft reference.
Updated Example 1-13 to API2 code
Example 1-14 had changes to the way a MemoryBlock was built. Updated Middle code from Mid, Updated declare.
Updated Example 1-18 to API2 with new references to Microsoft C++ code.
Updated Example 1-19 to API2 with code changes.
Example 1-16 updated to API2 and provided two methods for handing nil pointer value. Thanks to for the second method.
Added Example 1-21 for Project Warnings and Errors removal of issues using CType in API2.
Updated Example 2-1 to Xojo API 2 code – update text to value
Updated Example 2-2 – Updated to API 2 code
Example 2-3 API 2 updated code
Text to Value update with Example 2-4 for Xojo API 2 code
Update Example 2-5 to Xojo API 2
Example 2-6: API 2 code update for MemoryBlock
Example 2-7 Update text to value to API 2 update
Text to value update Example 2-8
Update Example 2-9 to API 2
42 updates to Example 2-10 to API 2
Update Example 3-1 with text to value
Update Example 3-2 to API 2 code
Msgbox to Messagebox update in Example 3-3, as well as InStr to IndexOf
Example 4-1 API updates: Text to Value, Dim to Var.
Example 4-2 updated to API2
Example 4-3 Len to Length, Dim to Var, and text to Value updates.
Update Example 4-4 to API 2 code
Example 4-5 update len to length, and use the new AddRow API2 command
Example 4-6: AbsolutePath to Nativepath, Volume to FolderItem.DriveAt updates to API2
Update AbsolutePath to NativePath, Volume to FolderItem.DriveAt update in Example 4-7
Update Example 4-8 to API2 code
Updated Left to String.Left, Right to String.Right, Volume to FolderItem.DriveAt, and other updates to API in Example 4-9 with over 21 updates
Example 4-10, removed unused variable, Ubound to LastRowIndex, Append to AddRow, InitialDirectory to InitialFolder, DeleteAllRows to RemoveAllRows, and over 18 updates to API2
Updated Example 4-11 to API2 code
DeleteAllRows to RemoveAllRows, HasHeading to HasHeader, Heading to HeaderAt, Cell to CellValueAt, MsgBox to MessageDialog.Show
Example 5-1, updated Ubound to LastRowIndex, Append to AddRow, and more to API2
Example 5-2 update to API2 code
Example 5-3 API2 code update
Update Example 5-5 to API2 code
Update API2 code in Example 5-6
Example 5-9: Update to API2 code, remove unused local variable
Example 5-10, removed unused local variable, and updated to API2 code
Example 6-1, removed unused local variable, MsgBox to MessageDialog, and numerous updates to API2 code.
Removed unused local variable, MsgBox to MessageDialog, and other API2 updates in Example 6-2.
Updated Example 6-3 to API2
Update Example 6-4 to API2
API2 update with Example 6-5, along with other updates
Modification of Example 6-6 and API2 update
Example 6-7 API2 update
Various API2 updates in Example 6-8 - Reported FailedAssertion error in Feedback.
Example 6-9 API2 updates
Example 6-10 API2 updates
GetFolderItem update to Folderitem.Constructor, and MsgBox to MessageDialog.show with other API2 updates in Example 6-11.
Example 6-12: remove unused local variable, and other API2 updates.
Updated Example 6-13 to API2.
Removed unused local variable, and other updates to API2 in Example 6-14, and reported Machine Linking Error.
Example 6-15: Local variable removed, Msgbox to MessageDialog.Show update, To Value from Text, and other API2 updates.
Remove unused local variable, and perform other API2 updates in Example 6-16.
Example 6-17 API2 updates: Redefined identifier, and workaround for Xojo.Rect unavailable in structures.
Example 6-18 – reported Compiler failed assertion at LinkLD.cpp:394, and changed various commands to API2.
Example 6-19, RECT reidentification with Xojo.Rect, submitted ‘Compiler failed assertion at MachineCodeLinker.cpp:83’, colour conversion, and performed various other API2 updates.
Example 6-20: Workaround Xojo.Rect, Uboud to LastRowIndex, MsgBox to MessageDialog.Show, and other updates to API2.
Example 6-21: Workaround Xojo.Rect, Uboud to LastRowIndex, MsgBox to MessageDialog.Show, and other updates to API2.
Example 6-22: Workaround Xojo.Rect, Uboud to LastRowIndex, MsgBox to MessageDialog.Show, and other updates to API2.
Example 7-1: MessageDialog, Length, and workaround for RECT structure to API2
Removed unused variable, workaround for RECT structure, Length, and other updates to API2 in Examples 7-2, 7-3, 7-4, 7-5, and 7-6.
Removed unused variable, workaround for RECT structure, Length, and other updates to API2 in Examples 8-1, 8-2, 8-3, 8-4.
Example 9-1: short to Int16, Text to SelectedRowValue, ListIndex to SelectedRowIndex, and more updates to API2
Example 9-2, workaround for Xojo.Rect, Text to SelectedRowValue, MsgBox to MessageDialog.Show, ListIndex to SelectedRowIndex, Short as Int16 and other updates to API2.
Example 10-1 updates to API2 include WinHWND to Handle and other updates.
Example 10-2 remove unused local variables, WinHWND to Handle, and other updates to API2.
Workaround Xojo.Rect, WinHWND to Handle, Len to Length, removed unused variables, and other updates to Example 10-3 for API2.
Example 11-1 various updates to API2, which includes AbsolutePath to NativePath, Volume to FolderItem.DriveAt, TrueChild to Child, and other updates.
Example 12-1: DeleteAllRows to RemoveAllRows, Remove unused variable, and other API2 updates.
Example 12-2 updates include Text to Value, DeleteAllRows to RemoveAllRows, remove unused variables, and other updates to API2.
Example 13-2 change from MsgBox to MessageDialog.Show and other API2 updates
MsgBox to MessageDialog.Show and other updates for Example 13-3 to API2.
Examples 13-3 and 13-4 have some updates to code for API2
Example 14-3, create workaround for Xojo.Point bug, Text to Value, and other updates for API2 code
Example 15-1, remove unused local variables, MsgBox to MessageDialog.Show, Text to Value, BackColor to BackgroundColor, and other API2 updates were performed.
Example 16-1, MsgBox to MessageDialog.Show, GetFolderItem to FolderItem.Constructor, OpenAsSound to SoundOpen, and other API2 updates.
Example 16-2, Text to Value, MsgBox to MessageDialog.Show, OpenDialog to OpenFileDialog, InitialDirectory to InitialFolder, GetFolderItem to FolderItem.Constructor, CountFields to MemoryBlock, CountFieldsB to CountFields, NthFieldB to NthField, and other API2 updates.
Example 16-3, MsgBox to MessageDialog.Show, OpenDialog to OpenFileDialog, Text to Value, InitialDirectory to InitialFolder, GetFolderItem to FolderItem.Constructor, CountFieldsB to CountFields, NthFieldB to NthField, Date to DateTime and conversion troubleshooting, and other API2 updates.
Example 16-4: MsgBox to MessageDialog.Show, OpenDialog to OpenFileDialog, InitialFolder to InitialDirectory, Text to Value, GetFolderItem to FolderItem.Constructor and other API2 updates.
Update Example 17-1 and 17-2 to various API2 code changes.
Example 18-1: removed unused local variable, text to Value, and other API2 upgrades
Example 19-1, general update to API2 code
Example 19-2: workaround Xojo.RECT, Text to Value, and other API2 code updates
Example 20-1: general update to API2
Example 20-2: Workaround for Xojo.RECT, reported Compiler failed assertion at MachineCodeLinker.cpp:83 error, general update to API2 code
Example 20-3: Workaround for Xojo.RECT, change calling code for GetMonitorInfoW and GetMonitorInfoA, and other updates to API2.
Example 21-1: Update State to VisualState, Text to Value, CheckedStates to VisualStates, and other updates to API2
Example 21-2: Update State to VisualState, Text to Value, CheckedStates to VisualStates, and other updates to API2
Example 21-3: Update Text to Value, MsgBox to MessageDialog.Show and other API2 updates.
Example 21-4: Text to Value upgrade, MsgBox to MessageDialog.Show, and other API2 upgrades.
Example 21-5: State to VisualState, CheckedStates to VisualStates, text to Value, and other API2 updates.
Example 21-6: State to VisualState, Text to Value, CheckedStates to VisualStates, and API2 updates to code.
Example 22-1: Update FolderItem to FolderItem with Pathmodes, Timer Modemultiple to multiple, mode to runmode, and other API2 Updates.
Example 22-2: removed unused local variable, MsgBox to MessageDialog.Show, Text to Value,
Example 22-3 updates include, removing unused variables, MsgBox to MessageDialog.Show, Text to Value, and other API2 code updates.
Removed Unused variables, MsgBox to MessageDialog.Show, Text to Value updates to API2 in Example 22-4, Example 22-5, Example 22-6, Example 22-7, Example 22-8, and Example 22-9
Example 23-1, 23-2, 23-3, updated to API2 code with various common codes.
Example 23-4: Update Len to Length, MsgBox to MessageDialog.Show, and other API2 updates.
Example 23-5 has numerous updates to Value from Text, Var from Dim, and many other updates.

Multiple updates to the remaining chapter that repeat those that were mentioned in the previous updates.

Hello Eugene,

Thank you for your excellent book, I just bought it. When I overviewed the table of contents, the amount of information is impressive. There is only one slight problem. When I unzipped the archive I received, another archive showed up in the directory I zipped to. Then I unzipped that second archive again and projects and PDF file were present.

I did a second try and again there seems to be a zip archive inside the first zip archive. No worries, when extracting the second zip archive, everything is perfect. Maybe you can take a look?

I strongly recommend this book to every serious Xojo developer!

In past times you also released an ebook about using graphics with the canvas control. Because of the recent changes, maybe a good idea to update this book too?

Thank you and keep up the good work!

Chris

Thanks for the kind words Chris. Your right, this book is not for a beginner programmer as there is a LARGE amount of information and data in the book.

That does seem weird. I’ll look into it and see what is happening. Thanks for letting me know about it!

That is a good idea. It looks like almost all of the books will need to be updated to the new API2 at some time. I have a long list of requests of new examples and stuff to be added to each of the books. Some requests are simple that can be completed in a day, while other requests are a complete book, an example is a book on animation with the canvas. Another request was to make a game engine, and almost everything else inbetween :slight_smile:

I am glad to see that you like the book, as I enjoy putting all of my findings, workarounds, and knowledge on a topic in a book for others to use.

Like I mentioned, I’ll look into the double-zip-thing and respond back. Thanks!!!

[quote=488926:@Chris Verberne]There is only one slight problem. When I unzipped the archive I received, another archive showed up in the directory I zipped to. Then I unzipped that second archive again and projects and PDF file were present.

I did a second try and again there seems to be a zip archive inside the first zip archive. No worries, when extracting the second zip archive, everything is perfect. Maybe you can take a look?[/quote]

There was a glitch when the files were uploaded to the server that caused double-zipping of files. It has been fixed and everything should work well now.

Thanks again Chris!

Awesome work Eugene! I know this was a huge undertaking and we all appreciate your hard work!

@Eugene Dakin great work on the Update
and as always @Marc Zeedar helped me out and processed my order