Implement API1 Declares With Xojo on Windows (XDL-0007)
Xojo Windows Declare Version 3.2 has just been finished with more examples, more constants, more data, more explanations, updates from ANSI to Unicode, all Windows 10 compatible, both 32-bit and 64-bit compatible, and updated to Xojo 2018 r3.
Xojo provides a RAD (Rapid Application Development) environment because it protects the user from the Operating System. Xojo has many helpful functions, and declares add to this existing toolbox.
Tapping into the Operating System directly with Declares opens up almost all of the options available for a program - but you are also out of the protection of the safe IDE (Integrated Development Environment) of Xojo. With the ability to change anything with the program or operating system, improper code also provides the ability of a crash. This is written for intermediate and advanced programmers of Xojo.
All examples have been converted to 32-bit, 64-bit, ANSI, and Unicode versions. This book is Version 3.0 (October 2018).
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 25 chapters and contains over 900 pages with over 140 example programs.
New to Version 3.3 -- July 2019
* Added NetUserGetLocalGroups for getting user local privileges (Example 31-1)
* Added NetUserGetGroups example for getting user global privileges (Example 31-2)
* Added `LOCALGROUP_USERS_INFO_0` structure (Example 31-1)
* Added `GROUP_USERS_INFO_0` structure (Example 31-2)
* Get a MemoryBlock from a pointer snippet (Example 24-12)
* Added WSAStartup, GetHostName, WSACleanup in Example 30-3.
* Added GetHostByName function with HOSTENT structure for 32-bit and 64-bit versions in Example 30-2. This is an ANSI function that does not exist with Unicode.
* Added GetAddrInfo function for ANSI, Unicode, 32-bit, and 64-bit compatibility with the following structures, constants, and functions in Example 30-3 for multiple numerical IP addresses from a string http address:
> * Socket function
> * Address family type constants (Appendix CJ)
> * Socket Type constants (Appendix CK)
> * Socket Protocol constants (Appendix CL)
> * Address Info flag constants (Appendix CM)
> * Socket Type constants (Appendix CN)
> * Socket error codes (Appendix CO)
> * WSAGetErrorCodes method
> * ADDRINFOW, ADDRINFOA structures
> * GetAddrInfoW, GetAddrInfoA functions
> * WSAErrorCodes Xojo method
> * Three variations (union overloading) of `in_addr1`, `in_addr2`, and `in_addr3`
* Added get MemoryBlock from pointer in example 24-12
* Added GetAdaptersAddresses to retrieve addresses and data from adapters in Example 30-4 and include other data:
> * GetAdapterAddresses function
> * Get Adapter Address Flags (Appendix CP)
> * `IP_ADAPTER_ADDRESSES_LH` Structures for 32-bit and 64-bit applications
> * `IP_ADAPTER_UNICAST_ADDRESS_LH` structures for 32-bit and 64-bit applications
> * `IP_ADAPTER_ANYCAST_ADDRESS_XP` structures for 32-bit and 64-bit apps
> * `SOCKET_ADDRESS` structures for 32-bit and 64-bit apps
> * Added IP Adapter Flags (Appendix CQ)
* Updated Appendix A with C++ to Xojo Data Type conversions (Thanks Julian)
New to Version 3.2 — May 2019
* Create a UUID/GUID with Example 26-3 using UuidCreate, UuidToStringA, UuidToStringW, RpcStringFreeA, and RpcStringFreeW. This is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
* Added RPC return value constants in Appendix CC.
* Added Example 5-9 to detect if a window is active (has focus or not). This required the GetActiveWindow and modified FindWindow API. This is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
* Added Example 5-10 to detect if a window is active (has focus or not) and relates it also to the Z-order value. This required the GetForegroundWindow and modified FindWindow API. This is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
* Added HiDPi chapter for working with various screen resolutions with the program and Operating System
* Added IsProcessDPIAware function to determine the OS’s ability to resize controls based on screen resolution in Example 28-1. This is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
* Added PROCESS_DPI_AWARENESS and common HRESULT constant values in Appendix CD and Appendix CE for Example 28-2 on Process DPI Awareness.
* Added DPI monitor scaling percent and retrieving other HiDPI settings using GetDpiForMonitor, and MonitorFromWindow functions in Example 28-3. This is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
* Added MONITOR_DPI_TYPE, and MONITOR enumerations in Appendix CF and CG.
* Added Standard Clipboard Format constants in Appendix CH
* Added Chapter 29 to send text to the clipboard (Example 29-* and get text from the clipboard (Example 29-*. This is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
New to Version 3.1 – Feb 2019
* Added Xojo CreateServiceW method in Example 22-2 for Creating a new application service on Windows.
* Added MultiByteToWideChar function for converting ANSI to Uncode in Example 26-1. This is 32-bit, 64-bit, ANSI, and Unicode compatible.
* Added WideCharToMultiByte function for converting Uncode to ANSI in Example 26-2. This is 32-bit, 64-bit, ANSI, and Unicode compatible.
* Added IsWindowUnicode method in Example 2-11 to determine if the Window is ANSI or Unicode.
* Added default enumeration type in Appendix A
* Added ShellExecuteEx extended function example (Example 13-4) and is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
* Added dynamic DLL loading and dynamic function calling in Exmaple 27-1. Added functions are: FreeLibrary, LoadLibraryA and W, GetProcAddress, and CallWindowProcW. This example is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
* Added dynamic reading of DLL functions with the DumpBin command in Example 27.2. this works on 32-bit and 64-bit systems.
* Added External Method declare to Hard and Soft section in Chapter 1.
The targets for Version 3.0 are the following:
* Minimize use of Aliases
* ANSI, Unicode, 32-bit, adn 64-bit compatible for older and newer computers
* Add new functions
* Add module methods for increased portability across programs
* More Constants
* More API Declares
* More working API examples
* More native Windows controls
* Added many TargetWindow conditional statements
* Standardize the writing of declare methods
* All examples work in Xojo 2018 R3
* Removed ByVal prefix's as this is the default setting
* Cleaned up previous code to be easier understood
* 30 added examples
* Over 66 updates
Note: Programming in Windows API is an advanced topic!
Examples include creating controls, a new window, GDI, Pens, brushes, Structures, Files, LoWord, Audio, play video, and much more. Many screenshots have been added to show the results of the code with an index to help find topics quickly.
The ebook is a pdf formatted document and all examples include Xojo code. The Table of Contents can be viewed at http://Scispec.ca.