WIN-PROLOG 4.2 Win32 Programming Guide.pdf

(2748 KB) Pobierz
by Brian D Steel
WIN-
PROLOG
Win32 Programming Guide
The contents of this manual describe the product,
WIN-
PROLOG,
version 4.2,
and are believed correct at time of going to press. They do not embody a
commitment on the part of Logic Programming Associates Ltd (LPA), who may
from time to time make changes to the specification of the product, in line with
their policy of continual improvement. No part of this manual may be
reproduced or transmitted in any form, electronic or mechanical, for any
purpose without the prior written agreement of LPA.
Copyright (c) 1992-2001 Brian D Steel and Logic Programming Associates Ltd
Designed and Written by Brian D Steel
The "wallpaper" used in the screen shots in this publication is based on the
Willow Boughs design by William Morris (1834-96)
Logic Programming Associates Ltd
Studio 4
The Royal Victoria Patriotic Building
Trinity Road
London SW18 3SX
England
phone:
fax:
email:
web:
+44 (0) 20 8871 2016
+44 (0) 20 8874 0449
support@lpa.co.uk
http://www.lpa.co.uk
2
WIN-
PROLOG
4.2
- Win32 Programming Guide
Table of Contents
WIN-PROLOG Win32 Programming Guide............................................ 2
Introduction ......................................................................................... 8
What's in WIN-PROLOG? ......................................................... 8
About this manual .................................................................... 8
Chapter 1 - WIN-PROLOG ................................................................... 9
WIN-PROLOG and DOS-PROLOG ........................................... 9
The Anatomy of LPA-PROLOG ................................................ 9
Differences between WIN-PROLOG and DOS-PROLOG ........... 10
Some Minor Limitations in Windows ........................................ 10
What’s in this Manual ............................................................. 11
Chapter 2 - The Console Window ....................................................... 12
The Main and Console Windows ............................................. 12
Typing Commands ................................................................. 13
Editing Commands ................................................................. 13
Re-entering Commands .......................................................... 14
Multi-line Commands .............................................................. 15
Breaking In ............................................................................ 18
Clearing the Console Window ................................................. 18
Output to the Console Window ............................................... 18
Output Buffering .................................................................... 19
Two-way Scrolling .................................................................. 20
Control Characters ................................................................. 22
Discriminating between Input and Output ................................. 22
Chapter 3 - Text Windows .................................................................. 25
Text Windows ........................................................................ 25
Modeless MDI Windows .......................................................... 25
Creating a Text Window ......................................................... 25
Entering Text ......................................................................... 26
Windows and Controls ............................................................ 27
Entering Further Commands ................................................... 28
Reading from a Text window................................................... 29
Writing to a Text window ........................................................ 29
Copying Text between Windows.............................................. 31
Closing a Text window ........................................................... 32
Rows, Columns and Offsets..................................................... 33
Finding a Line ........................................................................ 33
Counting Characters, Words and Lines .................................... 35
Finding Text .......................................................................... 36
The Window Dictionary .......................................................... 37
Chapter 4 - Standard Dialogs .............................................................. 38
Simple Modal Dialogs ............................................................. 38
The Message Box ................................................................... 38
Message Box Styles ................................................................ 40
WIN-
PROLOG
4.2
- Win32 Programming Guide
3
The About Box ...................................................................... 41
The Open and Save Boxes ...................................................... 41
The Font Box ........................................................................ 45
The Print and Print Setup Boxes ............................................. 47
The Status Box ...................................................................... 49
The Busy (Hourglass) Cursor ................................................... 50
Find and Change Boxes .......................................................... 50
Chapter 5 - User Windows and Dialogs ................................................ 52
User and Dialog Windows ....................................................... 52
Creating a User Window ......................................................... 52
Lack of Control ...................................................................... 53
Creating a Dialog Window ...................................................... 53
Differences between User and Dialog Windows ......................... 55
Creating Invisible Dialogs ........................................................ 56
Manipulating Dialogs .............................................................. 57
Changing Window Titles ......................................................... 58
Resizing Windows .................................................................. 59
Chapter 6 - Control Windows ............................................................. 62
Control Windows ................................................................... 62
Control Classes ...................................................................... 62
The Button Class.................................................................... 63
Programming Button Controls ................................................. 65
The Edit Class ........................................................................ 66
Programming Edit Controls ..................................................... 69
The Listbox Class ................................................................... 70
Programming Listbox Controls ................................................ 71
The Combobox Class ............................................................. 76
Programming Combobox Controls .......................................... 76
The Static Class ..................................................................... 77
Programming Static Controls .................................................. 78
The Scrollbar Class ................................................................. 79
The Grafix Class .................................................................... 81
Chapter 7 - Typefaces and Fonts ......................................................... 83
Typefaces versus Fonts ........................................................... 83
Predefined Fonts .................................................................... 83
Creating and Using a Font ...................................................... 84
Care in Font Handling ............................................................ 84
Closing a Font ....................................................................... 86
Enumerating Typefaces........................................................... 86
Checking Font Data ............................................................... 89
The Font Dictionary ............................................................... 90
Graphics Programming ........................................................... 90
Chapter 8 - Menus ............................................................................. 91
Predefined Menus................................................................... 91
Creating a Menu .................................................................... 91
Adding Items to a Menu .......................................................... 91
Removing Items from a Menu.................................................. 92
4
WIN-
PROLOG
4.2
- Win32 Programming Guide
Care in Menu Handling ........................................................... 93
Closing a Menu ...................................................................... 94
Checking Menu Entries ........................................................... 95
Separators, Checkmarks and Grey Menu Items ......................... 97
The Menu Dictionary .............................................................. 99
Chapter 9 - General Window Handling .............................................. 100
Window Handles .................................................................. 100
External Windows ................................................................ 101
Logical and Raw Handles ...................................................... 101
Finding an External Window Handle ...................................... 102
Window Styles ..................................................................... 103
Window Size and Area.......................................................... 106
Window Classes ................................................................... 107
Chapter 10 - Windows Messages ....................................................... 108
Windows and Messages ........................................................ 108
Prolog and Messages ............................................................ 108
Anatomy of a Message ......................................................... 108
Predefined Modeless Dialog Messages .................................... 109
Window Menu and State Messages ........................................ 109
Predefined and User Menu Messages ..................................... 110
Graphics Messages ............................................................... 111
Message Hooks and Subclassing ............................................ 111
Message Preprocessing ......................................................... 112
Window Handlers ................................................................. 113
'?FIND?'/3: The Find Box Hook ............................................ 113
'?CHANGE?'/3: The Change Box Hook ................................ 114
Modal Dialog Message Handlers ............................................ 115
Modeless Dialog Message Handlers ........................................ 116
Generic Window Handlers .................................................... 116
'?MESSAGE?'/4: The Message Hook ..................................... 116
Chapter 11 - Creating and Using Dialogs ........................................... 119
Dialog and Control Windows ................................................. 119
Building a Dialog .................................................................. 119
Writing a Modal Dialog Handler............................................. 120
Calling the Modal Dialog ....................................................... 121
Writing a Modeless Dialog Handler ........................................ 124
Calling the Modeless Dialog .................................................. 125
Responses and Actions ......................................................... 127
Freeing Memory Resources ................................................... 130
Chapter 12 - Graphics...................................................................... 132
Fundamental Considerations ................................................. 132
Windows and Device Contexts............................................... 133
Repainting Graphics ............................................................. 134
Graphics, "Button" and "Grafix" Windows ............................... 135
Messages and Graphics ......................................................... 137
MSG_PAINT - Window needs painting ................................... 137
MSG_LEFTDOWN - Left mouse button pressed ..................... 137
WIN-
PROLOG
4.2
- Win32 Programming Guide
5
Zgłoś jeśli naruszono regulamin