home *** CD-ROM | disk | FTP | other *** search
- Additions and corrections to Turbo Pascal for Windows manuals:
-
-
- ==============
- User's Guide
- ==============
-
- Chapter 6, The IDE reference
- ============================
-
- Glossary is no longer an option on the Help menu.
-
-
- ====================
- Programmer's Guide
- ====================
-
- Chapter 21, Compiler directives
- ===============================
-
- The $R directive for including resource files in an application can only be
- used on resource files of 64K or less. To attach larger resource files, such
- as large bitmaps, you need to use the Resource Compiler. For example, to
- attach the large resource file FOOBAR.RES to the application FOOBAR.EXE,
- pull down the Windows Program Manager's File|Run menu, and in the dialog
- box, type the command line
-
- RC FOOBAR.RES
-
- This will attach FOOBAR.RES to FOOBAR.EXE.
-
- Use of the Resource Compiler is described in greater detail in Chapter 18
- of the Windows Programming Guide.
-
-
- Chapter 24, Library reference
- =============================
-
- The example programs for the following standard procedures and functions
- should include the following uses clause
-
- uses WinCrt;
-
- in order to run correctly:
-
- Append, Assign, BlockRead, ChDir, Close, DiskFree, DiskSize, Eof, Eoln,
- Erase, FileSize, FillChar, FindFirst, GetFAttr, IOResult, Length,
- MemAvail, MkDir, ParamCount, ParamStr, Ptr, Reset, Rewrite, RmDir,
- SetFAttr, SetTextBuf, Val.
-
-
- Appendix A, Error messages
- ==========================
-
- Run-time errors 104 and 105, "File not open for input" and "File not open
- for output," respectively, will occur in programs that execute Readln or
- Writeln without using the WinCrt unit. Standard input and output files are
- not defined for Windows applications unless WinCrt appears in the uses
- clause.
-
-
- ===========================
- Windows Programming Guide
- ===========================
-
- Chapter 3, Filling in the window
- ================================
-
- On page 36, the text that follows the example should read as follows:
-
- The call to WVSPrintF does the type conversion and formatting.
-
- Chapter 6, Popping up windows
- =============================
-
- On page 73, the assignment to EC1 is missing a parameter and
- should read as follows:
-
- EC1 := New(PEdit, Init(@Self, id_EC1, '', 20, 180, 260, 90, 0, True));
-
- Chapter 12, Control objects
- ===========================
-
- Controls, messages, and parent windows
- --------------------------------------
-
- On page 159, the first paragraph, which describes how to keep notification
- messages from being passed to the parent window, is no longer valid. The
- process is actually much simpler. Instead of setting Msg.Result to 1 to
- stop the routing of the message, your object can simply handle the message.
- If it does not explicitly pass the message along to its parent, the parent
- window will not receive the notification.
-
- To pass the message to the parent window, simply call DefNotificationProc,
- which takes care of the routing to the parent window.
-
- Similarly, on page 176, the second paragraph describes notification messages
- for scroll bars. As with the general case just described, the scroll bar's
- parent window will not be notified by default. If you do want the parent
- window to process the message, simply call DefNotificationProc.
-
- The same sort of setup applies to the handling of command messages. If you
- want a parent window to process a command message after your object has
- done some processing, you call DefCommandProc. Like notification messages,
- command messages will not be routed to the parent window by default.
-
-
- Controls and the wm_Paint message
- ---------------------------------
-
- Most ObjectWindows objects respond to wm_Paint messages by calling their
- Paint methods. Controls, however, are painted somewhat differently. In
- most cases, you won't need to change the appearance of a control. If you
- want to change the color of a particular control or type of control, you
- can have your dialog object respond to wm_CtlColor messages.
-
- If you want to alter the appearance of a control, you have a couple of
- options. Many of the controls can be created with an owner-draw style,
- meaning that Windows sends an extra message, wm_DrawItem, to the parent
- window, which can then draw the appropriate control. If owner-drawing is
- not enough, the best option is probably to define a whole new type of
- control, which draws itself as you want it.
-
- You can also override the WMPaint message-response method, causing it to
- paint the control differently, but this is the least desirable option.
-
-
- =========================
- Windows Reference Guide
- =========================
-
- Chapter 2, Windows function reference
- =====================================
-
- AllocSelector
- -------------
-
- In addition to the text in the manual:
-
- Use of AllocSelector and related functions is not normal Windows
- programming practice. These functions should be avoided if possible.
-
-
- ChangeSelector
- --------------
-
- Declaration:
- function ChangeSelector(DestSelector, SourceSelector: Word): Word;
-
- Changes the attributes of a selector from code to data or vice
- versa. The value of the selector is not affected. Note that this is
- not normally done, and should only be done if absolutely necessary.
- The converted selector should be used immediately, as there is no way
- to keep the source and destination selectors synchronized.
-
- Parameters:
- DestSelector: The selector that receives the converted selector.
- Must have been previously allocated with AllocSelector
- SourceSelector: The selector to be converted.
-
- Returns:
- The converted selector, or zero if the conversion failed.
-
-
- DefineHandleTable
- -----------------
-
- Declaration:
- function DefineHandleTable(Offset: Word): Bool;
-
- Creates a private handle table in the default data segment. The table
- holds the addresses of locked global memory objects, as returned by
- GlobalLock. Windows updates these addresses when running in real mode,
- if the memory objects are moved. Addresses are not updated in protected
- modes (standard and 386-enhanced).
-
- The handle table consists of two Word-type values followed by an array of
- addresses. The first word is the number of entries in the table, which
- must be initialized before the call to DefineHandleTable. The second
- is the number of entries to set to zero when Windows updates its list of
- least-recently-used memory. Either word may be changed at any time. The
- addresses in the rest of the table are returned by GlobalLock.
-
- Parameters:
- Offset: The offset of the table from the beginning of the data
- segment. A value of zero indicates that Windows should no
- longer update the table.
-
- Returns:
- Non-zero if successful; otherwise, zero.
-
-
- DOS3Call
- --------
-
- Declaration:
- procedure DOS3Call;
-
- Calls the DOS interrupt function 21h. DOS3Call should only be called from
- assembly-language routines, as the registers for the INT 21h call must be
- set up. Under Windows, DOS3Call will work somewhat faster than a direct
- call to the software interrupt.
-
-
- FreeSelector
- ------------
-
- Declaration:
- function FreeSelector(Selector: Word): Word;
-
- Frees and invalidates a selector allocated by AllocSelector,
- AllocCStoDSAlias, or AllocDStoCSAlias.
-
- Parameters:
- Selector: The selector to free
-
- Returns:
- Zero if successful; otherwise, Selector.
-
-
- GetBitmapDimension
- ------------------
-
- Returns:
- If the dimensions have not been set (using SetBitmapDimension), the
- return value is zero.
-
-
- GetObject
- ---------
-
- Parameters:
- Count is the number of bytes to copy into ObjectPtr.
-
-
- GetPriorityClipboard
- --------------------
-
- Returns:
- In addition to the values described in the manual, returns 0 if there
- is nothing in the Clipboard.
-
-
- GetProfileInt
- -------------
-
- The function returns a Word-type value, not Integer.
-
-
- GetWindowsDirectory
- -------------------
-
- There is an error in the entry for GetWindowsDirectory. It is not a
- procedure, but rather a function returning a Word-type value.
-
- Declaration:
- function GetWindowsDirectory(Buffer: PChar; Size: Word): Word;
-
- Returns:
- The length of the string copied into Buffer.
-
-
- GlobalDiscard
- -------------
-
- Declaration:
- function GlobalDiscard(Mem: THandle): THandle;
-
- Discards the specified global memory block if the block is discardable
- and unlocked.
-
- Parameters:
- Mem: The handle of the global memory block to discard
-
- Returns:
- The handle of the block if successfully discarded, otherwise zero.
-
-
- GlobalDosAlloc
- --------------
-
- Declaration:
- function GlobalDosAlloc(Bytes: Longint): Longint;
-
- Allocates global memory in the first megabyte of linear address space
- that can be accessed by DOS. Use of this function should be avoided if
- possible, as low memory is a scarce system resource.
-
- Parameters:
- Bytes: The number of bytes to allocate
-
- Returns:
- Zero if memory could not be allocated. Otherwise, the value is a
- paragraph-segment value in the high-order word and a selector in the
- low-order word. In real mode, the paragraph-segment value can be used
- to access the allocated memory. In protected mode, the selector should
- be used.
-
-
- GlobalDosFree
- -------------
-
- Declaration:
- function GlobalDosFree(Selector: Word): Word;
-
- Frees a block of memory allocated by GlobalDosAlloc.
-
- Parameters:
- Selector: The selector of the memory to free
-
- Returns:
- Zero if successful; otherwise Selector.
-
-
- HiByte
- ------
-
- Declaration:
- function HiByte(A: Word): Byte;
- inline(
- $5A/ { POP AX }
- $8A/$C4/ { MOV AL,AH }
- $32/$E4); { XOR AH,AH }
-
- Extracts the high-order byte from a 16-bit integer value.
-
- Parameters:
- A: The 16-bit integer
-
- Returns:
- The high-order byte
-
-
- LoByte
- ------
- Declaration:
- function LoByte(A: Word): Byte;
- inline(
- $5A/ { POP AX }
- $32/$E4); { XOR AH,AH }
-
- Extracts the low-order byte from a 16-bit integer value.
-
- Parameters:
- A: The 16-bit integer
-
- Returns:
- The low-order byte
-
-
- LocalDiscard
- ------------
-
- Declaration:
- function LocalDiscard(Mem: THandle): THandle;
-
- Discards the specified local memory block, leaving its handle valid,
- meaning that the handle may be reused by calling LocalReAlloc.
-
- Parameters:
- Mem: The handle of the local memory block
-
- Returns:
- Zero if successful; otherwise Mem.
-
-
- NetBIOSCall
- -----------
-
- Declaration:
- procedure NetBIOSCall;
-
- Calls the NETBIOS interrupt 5Ch. This call should be used instead of a
- direct call to the 5Ch software interrupt for future compatibility.
-
- NetBIOSCall should only be called from within assembly-language routines,
- as the CPU registers must be set for the interrupt call.
-
-
- SetSysColors
- ------------
-
- The declaration for SetSysColors has changed slightly, with the last two
- parameters now being untyped var parameters:
-
- procedure SetSysColors(Changes: Integer; var SysColor; var ColorValues);
-
- The descriptions of the parameters in the manual are, however, correct.
-
-
- Chapter 4, Windows type reference
- =================================
-
- Dialog templates
- ----------------
-
- The Windows API functions CreateDialogIndirect, CreateDialogIndirectParam,
- DialogBoxIndirect, and DialogBoxIndirectParam take a pointer to a Windows
- data structure called DLGTEMPLATE or TDlgTemplate. This "structure" cannot,
- in fact, be defined as a Pascal record, or even as a C structure, because it
- has null-terminated string data embedded within it. Dialog templates, then,
- should be thought of as blocks of data to be read in a stream, rather than
- as data structures per se.
-
- A dialog template consists of three parts, only the first of which is
- required. First comes the dialog template header, then optional font
- information for the dialog, then template information for each of the
- items in the dialog box.
-
- All dialog templates begin with a dialog template header. The first six
- items in it are rigidly defined and named such that they might appear as
- a record like this:
-
- type
- DialogTemplateHeader = record
- dtStyle: Longint;
- dtItemCount: Byte;
- dtX, dtY: Integer;
- dtCX, dtCY: Integer;
- end;
-
- In essence, the block of dialog template information must contain first a
- long integer value defining the style of the dialog box. This value can be
- one of, or any combination of, the ds_ Dialog style constants. Next is a
- byte that gives the number of items in the dialog box, dtItemCount.
-
- Following those numbers are dtX and dtY, the x- and y-coordinates,
- respectively, of the upper-left corner of the dialog box. By default, these
- coordinates are relative to the origin of the parent window's client area,
- but if the dialog's style includes ds_AbsAlign, the coordinates are
- relative to the origin of the screen.
-
- dtCX and dtCY are, respectively, the width and height of the dialog box.
-
- A quick word is in order regarding the units used to define the coordinates
- and size of a dialog box. Dialog units are derived from the size of the
- current system font. The GetDialogBaseUnits API function returns the base
- unit size in pixels. Dialog coordinates and size are then expressed in
- fractions of the base unit. Horizontal components (dtX and dtCX) are
- expressed in units of 1/4 of the base width unit. Vertical components
- (dtY and dtCY) are in units of 1/8 the base height unit.
-
- Following the coordinates and size of the dialog box are three null-terminated
- strings, called dtMenuName, dtClassName, and dtCaptionText, respectively.
- These give the name of the dialog box's menu, the name of the dialog box's
- Windows class, and the dialog box's caption.
-
- If dtStyle contains the ds_SetFont constant, indicating that a font other
- than the current system font is to be used in the dialog, the caption text
- string must be followed immediately by two items describing the font: a
- short integer number giving the point size of the typeface, then a null-
- terminated string giving the name of the typeface. The specifed font must
- be available to Windows, either through the initialization file or through
- a call to the LoadFont API function.
-
- Immediately after the font information (if any) come dialog item templates,
- one for each control in the dialog box. The number of items is determined by
- the dtItemCount number.
-
- Each dialog item template consists of five integers, then a long integer, then
- two null-terminated strings, then a byte and (maybe) additional data. The
- first four integers are called dtilX, dtilY, dtilCX, and dtilCY. These define
- the position and size of the control, relative to the origin of the dialog
- box. The units for each of these are the same as the corresponding items
- in the dialog template header.
-
- Next comes dtilID, an integer which gives the dialog item ID of the control.
-
- Following the ID is dtilStyle, a long integer which holds the style of the
- dialog-box item.
-
- After the style information comes a null-terminated string holding the name
- of the control's Windows class, which can be BUTTON, EDIT, STATIC, LISTBOX,
- SCROLLBAR, or COMBOBOX.
-
- Immediately after the class name is another null-terminated string, dtilText,
- which holds the text for the item.
-
- After the strings comes a byte called dtilInfo, which tells how many bytes of
- additional information follow. A value of zero indicates that there is no
- additional information, and therefore terminates the dialog item template.
- If dtilInfo is non-zero, the next group of bytes, called dtilData, hold
- information that is passed to the CreateWindow function in the CreateParams
- field of a TCreateStruct.
-
-
- MakePoint
- ---------
-
- Declaration:
- MakePoint = TPoint;
-
- MakePoint is used for typecasting long integer numbers into TPoint records.
-
-
- TDlgTemplate
- ------------
-
- TDlgTemplate is not truly a type, and cannot be represented in Pascal (or
- any other programming language). Windows API calls that require a
- TDlgTemplate "structure" actually take a pointer to a block of information
- which is defined earlier in this file under "Dialog templates."
-
-
- TMenuItemTemplate
- -----------------
-
- Declaration:
- TMenuItemTemplate = record
- mtOption: Word;
- mtID: Word;
- mtString: PChar;
- end;
-
- The TMenuItemTemplate record holds information for a menu item.
- TMenuItemTemplate records can be strung together to form a list of
- menu items. Combined with a TMenuItemTemplateHeader, this list forms
- a complete menu template.
-
- The mtOption field contains one of (or a combination of) the mf_ Menu flag
- constants, such as mf_Grayed, mf_Popup, and so on. These define the type
- and state of the menu item.
-
- The mtID field holds an ID code for the menu item. Pop-up menu items (those
- that bring up another menu) do not have an mtID field.
-
- The mtString field holds a null-terminated string, specifying the name of
- the menu item.
-
-
- TMenuItemTemplateHeader
- -----------------------
-
- Declaration:
- TMenuItemTemplateHeader = record
- versionNumber: Word;
- offset: Word;
- end;
-
- The TMenuItemTemplateHeader serves as the header for a menu template. A
- complete menu template consists of a header and an item list. The item list
- is usually a list of TMenuItemTemplate records.
-
- The versionNumber field holds the version number of the menu template. This
- should be zero. The offset field gives the offset (in bytes) of the beginning
- of the item list, relative to the header.
-
-
- Chapter 5, ObjectWindows reference
- ==================================
-
- TDialog object
- --------------
-
- Methods deleted:
- Destroy
- TDialog.Destroy no longer exists. TDialog uses the inherited Destroy
- method from TWindowsObject.
-
- EnterCancel and EnterOK
- These methods are no longer needed. Instead of generating a command-
- based message when Enter is pressed to activate an OK or Cancel button,
- ObjectWindows will generate a notification message based on the control
- ID of the button "pressed," just as if it had been clicked with the mouse.
-
-
- TDlgWindow object
- -----------------
-
- The class name of the dialog window's resource (as defined in the Resource
- Compiler script or dialog editor) must match the class name of the
- TDlgWindow object instance. If the class names do not match, the one given
- in the resource template will be used.
-
- Methods deleted:
- Cancel and OK are no longer overridden by TDlgWindow. The methods inherited
- from TDialog are used instead.
-
- TScroller object
- ----------------
-
- New field
-
- AutoOrg
-
- Declaration:
- AutoOrg: Boolean;
-
- When AutoOrg is True, the origin of the display context (DC)
- passed to the parent window's Paint method is automatically
- adjusted so all calls using that DC reflect the position of the
- scroll bars. This frees you from having to manually adjust the
- coordinates used when painting the window's client area. When
- AutoOrg is False, you must do this mapping manually.
-
- If the scrollable range can exceed 32767, AutoOrg must be set
- to False.
-
- Note that when AutoOrg is True, child windows are automatically
- repositioned based on the scroll bar positions. When AutoOrg is
- False, child windows are not supported.
-
-
- TWindow object
- --------------
-
- New method
-
- WMMove
-
- Declaration:
- procedure WMMove(var Msg: TMsg); virtual wm_First + wm_Move;
-
- Updates Attr.X and Attr.Y when the wm_Move message is received, unless the
- window is iconic or zoomed, in which case the message is ignored.
-
-
- TWindowsObject object
- ---------------------
-
- New methods:
-
- CreateChildren
-
- Declaration:
- function CreateChildren: Boolean;
-
- Calls Create for all child windows. Called automatically by SetupWindow, so
- you don't normally need to call it directly. CreateChildren need only be
- called after GetChildren, to create visual elements for child window objects
- loaded from a stream.
-
- See also: TWindowsObject.GetChildren
-
-
- WMQueryEndSession
-
- Declaration:
- procedure WMQueryEndSession(var Msg: TMsg);
- virtual wm_First + wm_QueryEndSession
-
- If the window is the application's main window, it responds to the
- wm_QueryEndSession message by calling Application^.CanClose, and if that
- returns True, sets Msg.Result to 1; otherwise, it sets Msg.Result to 0.
-
- See also: wm_QueryEndSession message
-
-
- Changed example:
-
- ForEach
-
- The code example at the end of the description of ForEach contains an
- error. The line
-
- ForEach(@CheckAllBoxes);
-
- should read
-
- ForEach(@CheckTheBox);
-
-
- Chapter 6, Global reference
- ===========================
-
- MemAlloc function (WObjects unit)
- ---------------------------------------------
-
- Declaration:
- function MemAlloc(Size: Word): Pointer;
-
- Function:
- Allocates Size bytes of memory on the heap and returns a pointer to the
- block. If a block of the requested size cannot be allocated, a value of
- nil is returned. As opposed to the New and GetMem standard procedures,
- MemAlloc will not allow the allocation to dip into the safety pool. A
- block allocated by MemAlloc can be disposed using the FreeMem standard
- procedure.
-
- Note:
- MemAlloc was inadvertantly referred to as AllocMem in a couple of
- places in the documentation.
-
-
- ===============
- Help Compiler
- ===============
- The most up-to-date source code for the HELPEX example is
- contained on disk in the \TPW\DOCDEMOS\HELPEX directory. Note
- that OWLHELP.PAS, an ObjectWindows version of HELPEX, is also
- provided.
-
- =============================
- Whitewater Resource Toolkit
- =============================
-
- Chapter 9, The Header editor
- ============================
-
- The Resource Toolkit now supports Turbo Pascal include files as well
- as C-style header files. This information is in the latest help file.
-
- The header file can be either a C-style (.h) file, or a Pascal
- include (.INC) file.
-
- The syntax is restricted whether it is a .h or .INC file.
-
- The Header editor supports only #define (C) or const (Pascal)
- statements that define constants in decimal or hexadecimal format.
- C-style header files may also contain C-style /* */ comments. A
- Pascal include file cannot contain anything else, not even comments.
-
- If you try to open a C-style .h file or a Pascal INC file containing
- anything else, the Header editor will issue an error message and open
- a new, blank .h or .INC file.
-
- When you open a C-style .h file containing comments, the comments are
- ignored when the file is opened. Once you save the .h file with the
- Header editor, all comments are deleted and only the #define
- statements are saved.