Xojo Windows Declare Version 3.3 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 2019 r1.
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.
Thanks to Julian Samphire for work on the 64-bit version of the ChooseColor example and for his comprehensive list of Xojo Data Type Conversions.
All examples have been converted to 32-bit, 64-bit, ANSI, and Unicode versions.This book is Version 3.3 (August 2019).
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 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.
Screen grab of the ChooseColor Dialogue Box example 15-1:
Play a Video (MPEG screen grab of video shown):
Play an Audio File with details:
Added API Calendar Control (Example 6-9)
Added API Keyboard (Example 25-1)
...and many more.
New to Version 3.0 – December 2018
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
Updates
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) Added Xojo CreateServiceW method in Example 22-2 for Creating a new application service on Windows
1) 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.
2) Added RPC return value constants in Appendix CC.
3) 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.
4) 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.
5) Added HiDPi chapter for working with various screen resolutions with the program and Operating System
6) 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.
7) Added PROCESS_DPI_AWARENESS and common HRESULT constant values in Appendix CD and Appendix CE for Example 28-2 on Process DPI Awareness.
8) 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.
9) Added MONITOR_DPI_TYPE, and MONITOR enumerations in Appendix CF and CG.
10) Added Standard Clipboard Format constants in Appendix CH
11) Added Chapter 29 to send text to the clipboard (Example 29-1) and get text from the clipboard (Example 29-2). This is compatible with 32-bit, 64-bit, ANSI, and Unicode Operating Systems.
1) Added NetUserGetLocalGroups for getting user local privileges (Example 31-1)
2) Added NetUserGetGroups example for getting user global privileges (Example 31-2)
3) Added LOCALGROUP_USERS_INFO_0 structure (Example 31-1)
4) Added GROUP_USERS_INFO_0 structure (Example 31-2)
5) Get a MemoryBlock from a pointer snippet (Example 24-12)
6) Added WSAStartup, GetHostName, WSACleanup in Example 30-3.
7) 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.
8) 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:
a. Socket function
b. Address family type constants (Appendix CJ)
c. Socket Type constants (Appendix CK)
d. Socket Protocol constants (Appendix CL)
e. Address Info flag constants (Appendix CM)
f. Socket Type constants (Appendix CN)
g. Socket error codes (Appendix CO)
h. WSAGetErrorCodes method
i. ADDRINFOW, ADDRINFOA structures
j. GetAddrInfoW, GetAddrInfoA functions
k. WSAErrorCodes Xojo method
l. Three variations (union overloading) of in_addr1, in_addr2, and in_addr3
9) Added get MemoryBlock from pointer in example 24-12
10) Added GetAdaptersAddresses to retrieve addresses and data from adapters in Example 30-4 and include other data:
a. GetAdapterAddresses function
b. Get Adapter Address Flags (Appendix CP)
c. IP_ADAPTER_ADDRESSES_LH Structures for 32-bit and 64-bit applications
d. IP_ADAPTER_UNICAST_ADDRESS_LH structures for 32-bit and 64-bit applications
e. IP_ADAPTER_ANYCAST_ADDRESS_XP structures for 32-bit and 64-bit apps
f. SOCKET_ADDRESS structures for 32-bit and 64-bit apps
g. Added IP Adapter Flags (Appendix CQ)
11) Updated Appendix A with C++ to Xojo Data Type conversions
This is one of the many available books at Xojo Library where many Xojo resources are available.
ISBN: 978-1-927924-10-5