This help file has not only the syntax of all of the APIs, but also has excellent explanations of some of the concepts of Windows programming. If you use it only to look up an API to see what it does, you are missing a lot of what it can do for you.
For example, there are a number of sections with titles like "About Handles and Objects", "About Dialog Boxes", "About Menus", "About Bitmaps", etc. Read up on these in your spare time. All of the Windows messages are explained. Look up WM_ and take a look at the list of messages. Read up on these in your spare time. Some of the topics have sample code which is helpful. Of course, it will be in the "C" programming language, but will still be useful.
There are some specific topics that you will want to read that will explain a number of things you will see in a lot of programs, e.g., System-Defined Messages, Application-Defined Messages, Painting and Drawing (and all about the WM_PAINT message).
This is the help file that is available when you use the Help function in the PowerBasic IDE (Integrated Development Environment) or the main development program. This includes not only the complete syntax of all of the language commands, but also a good bit of background information, and some source code examples as well.
You will want to spend a lot of time here, because this is where all of the PowerBasic experts are to be found. Chances are that someone has already asked the question you have and chances are that it has been answered, quite possibly with a working example.
1. SDK (Software Development Kit) style programming (in any language) means separating the source code file from the layout of the windows, dialog boxes, and other "resources" used by the program, like icons, bitmaps, etc. These resources are placed in a "resource file" which gets compiled separately. (Note: The "Resource Compiler" has its own Help File). Utility programs from Microsoft are available as part of the PowerBasic development software to create most of these resources.
2. DDT (Dynamic Dialog Tools) is a feature that PowerBasic includes that allows you to specify and create windows (dialog boxes) directly in the source code. Many of the example programs you will find in the PowerBasic forums will be DDT style programs, because it is quick to write an example program as a single file which the reader can copy, paste, and compile in PowerBasic.
3. Third party software is available for generating both SDK and DDT style code and resources, with most of it being very helpful and affordable.
WIN32API.INC is the equates, types, and declarations for calling the Windows API from your PowerBASIC programs.
Helpful hint: Whenever you see an equate used as an option, (something that begins with the % sign), search for it in WIN32API.INC and find out all of the other options available for that API.
COMDLG32.INC is the Windows API Common Dialog declarations. Common Dialog boxes are things like a Printer dialog box that you get right before printing, or the FileOpen dialog box which lets you select from a list of files. You will want to look up the available options to the Common Dialogs too.
COMMCTRL.INC is the declarations for Common Controls, like scroll bars, progress bars, up-down controls, etc. A list of the Common Controls and details about them is in the Win32 Help File.
Data types and naming variables-
Some programmers name variables according to a convention known as Hungarian notation. This type of naming indicates what data type the variable is just by looking at its name. For example lpszName would be a long pointer (lp) to a string (s) of the ASCIIZ type (z). This type of notation is helpful when trying to understand how someone's code works, however if not explained, this type of naming seems strange and unnecessary.
Since Windows programming involves the use of many "Handles", one of the most used naming conventions is naming variables that store handles with an "h" as the first character. For example, hWnd as a handle to a window, hDlg as the handle to a dialog box, etc.
In the PowerBasic on-line help file, examples are often given that show the result of a command using a variable ending with & character. This character is not really needed, but is there in the example to remind you that the command returns a long integer.
For example, s$ = LEFT$(string_expression, n&) means that the LEFT$ function returns a string ($) and requires a numeric value (&) as one of the arguments.
Near the beginning of code and resource files you will often find equates that are named things like %ID_THIS or %IDM_THAT. Since each control in a window or dialog box needs a unique identifier (number) most people use these equates to identify the control. The prefixes to these equates are sometimes used to further identify the equate, for example, IDM for an ID for a menu. Note that IDOK, IDCANCEL, IDRETRY, IDYES, IDNO, IDCLOSE, IDHELP and others are predefined in WIN32API.INC.
Note: The first equate should normally be %WM_USER, which is a constant that Windows specifies as the first in a group of numbers to be used to define private messages (or your controls). Subsequent equates should be %WM_USER + (plus some number assigned by you.)
%NULL, %TRUE, and %FALSE-
In WIN32API.INC they are defined as: %TRUE = 1 %FALSE = 0 %NULL = 0 You will want to look up the ISTRUE, ISFALSE, and NOT operators in the PowerBasic on-line help file to see why using these equates is not very obvious and straightforward.
Code shortcuts and non-intuative construction-
If you have never programmed in the "C" programming language or are new to Windows programming, some of the conditional statements you see in PowerBasic will seem strange. One of the favorite things that programmers experienced in this type of programming like to do is to write shortcuts.
One of the most confusing shortcuts is calling a function which returns a True or False result within a conditional statement, which obscures its meaning to less experienced programmers. The following is a typical example.
"If the result (returned value) of the function is anything but zero then condition is True."
IF FunctionName() THEN ... do something END IF
This construction is possible because an IF statement is True if the condition is anything but zero.
The following is the equivalent code but much more obvious, however, you will see this type of code much less often because the variable "result" must be defined.
result = FunctionName() IF result <> 0 THEN ... do something END IF