Windows API Guide Reference Volume 3 1992 PDF
Windows API Guide Reference Volume 3 1992 PDF
1
REFERENCE GUIDE
BORLAND
Reference
Volume 3
Version 3.1
for the MS-DOS and PC-DOS
Operating Systems
Chapter 1
Common dialog
box library
21
21
23
23
25
26
27
27
28
28
.
31
32
34
35
37
38
39
39
40
40
42
43
45
47
47
48
48
48
52
54
57
57
58
59
60
61
62
63
64
66
66
Table of Contents
ChooseFont . . . . . . . . . . . . . . . . . . . . . . .
ClassFirst . . . . . . . . . . . . . . . . . . . . . . . . .
ClassNext ........................
CloseDriver .......................
CommDlgExtendedError '" .. '" ...
CopyCursor ......................
Copylcon ., '" ....................
CopyLZFile .................. '" ..
CPIAppiet ........................
CreateScalableFontResource ........
DdeAbandonTransaction ...........
DdeAccessData ...................
DdeAddData .....................
DdeCallback . . . . . . . . . . . . . . . . . . . . ..
DdeClientTransaction . . . . . . . . . . . . . .
DdeCmpStringHandles ............
DdeConnect ......................
DdeConnectList ...................
DdeCreateDataHandle .............
DdeCreateStringHandle . . . . . . . . . . . .
DdeDisconnect ....................
DdeDisconnectList ................
DdeEnableCallback ................
DdeFreeDataHandle ...............
DdeFreeStringHandle ..............
DdeGetData ......................
DdeGetLastError ..................
DdeInitialize . . . . . . . . . . . . . . . . . . . . . .
DdeKeepStringHandle . . . . . . . . . . . . .
DdeNameService ..................
DdePostAdvise ...................
DdeQueryConvInfo ...............
DdeQueryNextServer ..............
DdeQueryString ..................
DdeReconnect ....................
DdeSetUserHandle ................
DdeUnaccessData .................
DdeUninitialize ...................
147
148
149
150
151
154
155
155
157
157
160
162
163
165
167
170
172
174
176
179
181
181
182
183
185
186
187
190
194
195
197
199
200
202
203
204
205
206
iii
DebugOutput .....................
DebugProc .......................
DeillriverProc ....................
DirectedYield .....................
DIgDirSelectComboBoxEx ..........
DIgDirSelectEx ....................
DragAcceptFiles ...................
DragFinish ........................
DragQueryFile ....................
DragQueryPoint ...................
DriverProc ........................
EnableCommNotification ...........
EnableScrollBar ...................
EndDoc ..........................
EndPage ..........................
EnumFontFamilies .................
EnumFontFamProc ................
EnumFontsProc ...................
EnumMetaFileProc ................
EnumObjectsProc .................
EnumPropFixedProc ., .............
EnumPropMovableProc ............
EnumTaskVVndProc ...............
EnumVVindowsProc ...............
ExitVVindowsExec .................
Extractlcon .......................
FindExecutable ....................
FindText .........................
FMExtensionProc ..................
FreeAllGDIMem ..................
FreeAllMem ......................
FreeAllUserMem ..................
GetAspectRatioFilterEx ............
GetBitmapDimensionEx ............
GetBoundsRect ....................
GetBrushOrgEx ...................
GetCharABCVVidths ...............
GetClipCursor ....................
iv
207
208
209
210
211
212
213
213
214
214
215
217
218
220
220
221
222
225
227
228
230
231
232
232
233
234
234
236
238
239
240
240
240
241
241
243
243
244
GetCurrentPositionEx ..............
GetCursor ........................
GetDCEx .........................
GetDriverInfo .....................
GetDriverModuleHandle ...........
GetExpandedName ................
GetFileResource . . . . . . . . . . . . . . . . . . .
GetFileResourceSize ...............
GetFileTitle .......................
GetFileVersionlnfo ................
GetFileVersionlnfoSize . . . . . . . . . . . . .
GetFontData ., ....................
GetFreeFileHandles . . . . . . . . . . . . . . . .
GetFreeSystemResources ...........
GetGlyphOutline ..................
GetKerningPairs ..................
GetMessageExtralnfo ..............
GetMsgProc ......................
GetNextDriver ....................
GetOpenClipboardVVindow ........
GetOpenFileName .. , ..............
GetOutlineTextMetrics .............
GetQueueStatus ...................
GetRasterizerCa ps . . . . . . . . . . . . . . . . .
GetSaveFileN ame .................
GetSelectorBase ...................
GetSelectorLimit ..................
GetSystemDebugState .............
GetSystemDir . . . . . . . . . . . . . . . . . . . . .
GetTextExtentPoint ................
GetTimerResolution ...............
GetViewportExtEx ................
GetViewportOrgEx ................
GetVVinDebuglnfo .................
GetVVindowExtEx .................
GetVVindowOrgEx .................
GetVVindowPlacement .............
GetVVindowsDir ...................
245
245
246
247
248
249
250
251
252
253
254
254
257
257
258
260
261
261
262
263
264
266
268
269
270
272
273
273
274
275
276
276
276
277
278
278
278
279
Table of Contents
vi
OleRenameClientDoc ..............
OleRenameServerDoc ..............
OleRequestData ...................
OleRevertClientDoc ...............
OleRevertServerDoc ...............
OleRevokeClientDoc ...............
OleRevokeObject ..................
OleRevokeServer ..................
OleRevokeServerDoc ..............
OleSavedClientDoc ................
OleSavedServerDoc ...............
OleSaveToStream .................
OleSetBounds .....................
OleSetColorScheme ................
OleSetData .......................
OleSetHost~ames .................
OleSetLinkUpdateOptions ..........
OleSetTargetDevice ................
OleUnblockServer .................
OleUnlockServer ..................
OleUpdate ........................
OpenDriver .......................
PrintDlg ..........................
QueryAbort ......................
QuerySendMessage ...............
RedrawWindow ..................
RegCloseKey .....................
RegCreateKey .....................
RegDeleteKey .....................
RegEnumKey .....................
RegOpenKey .....................
RegQueryValue ...................
RegSetValue ......................
ReplaceText ......................
ResetDC ..........................
ScaleViewportExtEx ...............
ScaleWindowExtEx ................
ScrollWindowEx ..................
395
396
396
397
398
399
399
400
400
401
402
402
403
404
405
406
407
408
409
410
411
411
412
415
415
416
419
420
422
423
424
425
426
427
430
431
432
432
SendDriverMessage ...............
SetAbortProc ......................
SetBitmapDimensionEx ............
SetBoundsRect ....................
SetMetaFileBitsBetter ..............
SetSelectorBase ....................
SetSelectorLimit ...................
SetViewportExtEx .................
SetViewportOrgEx .................
SetWinDebuglnfo .................
SetWindowExtEx .......... '" .....
SetWindowOrgEx .................
SetWindowPlacement ..............
SetWindowsHookEx ...............
ShellExecute ......................
ShellProc .........................
SpoolFile .........................
StackTraceCSIPFirst ...............
StackTraceFirst ....................
StackTrace~ext ...................
StartDoc ..........................
StartPage .........................
SubtractRect ......................
SysMsgProc ......... , .............
SystemHeaplnfo .......... , ........
SystemParameterslnfo .............
TaskFindHandle ..................
TaskFirst .........................
TaskGetCSIP .............. , " .....
Tas~ ext .........................
TaskSetCSIP ......................
TaskSwitch .......................
TerminateApp ....................
TimerCount .......................
TimerProc ........................
UnAllocDiskSpace ... , .............
UnAllocFileHandles ...............
UndeleteFile ......................
Table of Contents
435
435
436
437
438
439
439
439
440
442
443
444
444
445
448
451
452
453
454
455
456
457
457
458
459
460
466
467
468
468
469
470
470
471
472
473
473
474
UnhookWindowsHookEx ..........
Ver FindFile . . . . . . . . . . . . . . . . . . . . . . .
VerlnstallFile .....................
VerLanguage~ame ................
VerQueryValue ...................
WindowProc ......................
W~etAddConnection ..............
W~etCancelConnection .. " ........
W~ etGetConnection ...............
WordBreakProc '" ................
Chapter 5
Data types
474
475
478
482
484
487
488
489
489
490
493
Chapter 6
Messages
503
CB_ADDSTRI~G ................. 503
CB_DELETESTRI~G .............. 504
CB_FI~DSTRI~GEXACT .......... 505
CB_GETDROPPEDCO~TROLRECT 505
CB_GETDROPPEDSTATE .......... 506
CB_GETEXTE~DEDUI ............ 507
CB_GETITEMHEIGHT ............. 507
CB_SETEXTE~DEDUI ............. 508
CB_SETITEMHEIGHT ............. 509
EM_GETFIRSTVISIBLELI~E ....... 510
EM_GETPASSWORDCHAR ........ 510
EM_GETWORDBREAKPROC ...... 511
EM_SETREADO~LY .............. 511
EM_SETWORDBREAKPROC ....... 512
LB_FI~DSTRI~GEXACT .......... 513
LB_GETCARETI~DEX ............ 514
LB_SETCARETI~DEX ............. 514
STM_GETICO~ ................... 515
STM_SETICO~ ................... 515
WM_CHOOSEFO~T_GETLOGFO~T ............................ 516
WM_COMM~OTIFY .............. 516
WM_DDE_ACK ................... 517
Posting ....................... 519
Receiving . .................... 519
vii
viii
Chapter 7 Structures
539
ABC ............................. 539
CBT_ CREATEWND ............... 540
CBTACTIVATESTRUCT ........... 540
CHOOSECOLOR .................. 541
CHOOSEFONT ................... 544
CLASSENTRY .................... 551
COMSTAT ....................... 552
CONVCONTEXT ................. 553
CONVINFO ...................... 554
CPLINFO ........................ 557
CTLINFO ........................ 558
CTLSTYLE ....................... 559
CTLTYPE ........................ 561
DDEACK ......................... 562
DDEADVISE ..................... 563
DDEDATA ....................... 564
DDEPOKE ....................... 565
DEBUGHOOKINFO ............... 566
DEVNAMES ...................... 567
DOCINFO ........................ 568
DRIVERINFOSTRUCT ............. 569
DRVCONFIGINFO ................ 569
EVENTMSG ...................... 570
FINDREPLACE ................... 571
FIXED ........................... 575
FMS_GETDRIVEINFO ............. 576
FMS_GETFILESEL ................ 577
FMS_LOAD ...................... 578
GLOBALENTRY .................. 579
GLOBALINFO .................... 582
GLYPHMETRICS ................. 583
HARDWAREHOOKSTRUCT ....... 584
HELPWININFO ................... 584
HSZPAIR ........................ 585
Table of Contents
586
587
590
591
592
593
594
595
596
597
598
599
600
602
603
604
605
606
607
612
613
614
615
616
617
617
618
619
620
620
621
624
624
624
624
625
625
625
625
625
626
626
626
626
627
627
627
627
627
627
628
628
628
629
629
630
630
631
631
631
632
632
632
633
633
633
633
634
634
634
634
635
635
635
636
636
ix
SEGINFO ........................
SIZE .............................
STACKTRACEENTRY .............
SYSHEAPINFO ...................
TASKENTRY .....................
TIMERINFO ......................
TTPOL YCURVE ..................
TTPOLYGONHEADER ............
VS_FIXEDFILEINFO ...............
WINDEBUGINFO .................
WINDOWPLACEMENT ...........
WINDOWPOS ....................
673
675
676
677
678
679
680
681
682
686
690
692
Chapter 8 Macros
695
DECLARE_HANDLE .............. 695
DECLARE_HANDLE32 ............ 695
FIELDOFFSET .................... 696
GetBValue ........................ 696
GetGValue ....................... 697
GetRValue ........................ 697
MAKELP ......................... 697
MAKELPARAM .................. 698
MAKELRESULT .................. 698
OFFSETOF ....................... 699
SELECTOROF .................... 699
Chapter 9 Printer escapes
701
MOUSETRAILS ................... 701
POSTSCRIPT_OATA .............. 702
POSTSCRIPT_IGNORE ............ 702
SETALLJUSTVALUES ............. 703
Chapter 10 Dynamic Data
Exchange transactions 705
XTYP_ADVDATA ................. 705
XTYP_ADVREQ .................. 706
XTYP_ADVSTART ................ 707
XTYP_ADVSTOP ................. 708
XTYP_CONNECT ................. 708
XTYP_CONNECT_CONFIRM ......
XTYP _DISCONNECT ..............
XTYP _ERROR ....................
XTYP_EXECUTE ..................
XTYP _MONITOR .................
XTYP_POKE ......................
XTYP_REGISTER ..................
XTYP_REQUEST ..................
XTYP _UNREGISTER ..............
XTYP_WILDCONNECT ...........
XTYP_XACT_COMPLETE ..........
Chapter 11 Common dialog
box messages
COLOROKSTRING ................
FILEOKSTRING ...................
FINDMSGSTRING ................
HELPMSGSTRING ................
LBSELCHSTRING .................
SETRGBSTRING ..................
SHAREVISTRING .................
Index
Table of Contents
709
710
711
711
712
713
714
715
715
716
717
719
719
720
721
721
722
723
723
725
xi
1
Common dialog box library
Common dialog boxes make it easier for you to develop
applications for the Microsoft Windows operating system. A
common dialog box is a dialog box that an application displays
by calling a single function rather than by creating a dialog box
procedure and a resource file containing a dialog box template.
The dynamic-link library COMMDLG.DLL provides a default
procedure and template for each type of common dialog box.
Each default dialog box procedure processes messages and
notifications for a common dialog box and its controls. A default
dialog box template defines the appearance of a common dialog
box and its controls.
In addition to simplifying the development of Windows
applications, a common dialog box assists users by providing a
standard set of controls for performing certain operations. As
Windows developers begin using the common dialog boxes in
their applications, users will find that after they master using a
common dialog box in one application, they can easily perform
the same operations in other applications.
This chapter describes the various common dialog boxes and
includes sample code to help you use common dialog boxes in
your Windows applications.
Description
Color
Font
Open
Save As
Print Setup
Find
Replace
'WINSTUB.EXE'
CODE
DATA
HEAPSIZE
1024
STACKSIZE8192
EXPORTS
FILEOPENHOOKPROC
@1
!!.asic Colols:
!;.ustom Colols:
lum:
[@
Blye:
display driver displays only 16. With the Basic Colors control, the
user can select a displayed color.
To display the Custom Colors control, the user clicks the Define
Custom Colors button. The Custom Colors control displays
custom colors. The user can select one of the 16 rectangles in this
control and then create a new color by using one of the following
methods:
Specifying red, green, and blue (RGB) values by using the Red,
Green, and Blue edit controls, and then choosing the Add to
Custom Colors button to display the new color in the selected
rectangle.
Moving the cursor in the color spectrum control (at the
upper-right of the dialog box) to select hue and saturation
values; moving the cursor in the luminosity control (the
rectangle to the right of the spectrum control); and then
choosing the Add to Custom Colors button to display the new
color in the selected rectangle.
Specifying hue, saturation, and luminosity (HSL) values by
using the Hue, Sat, and Lum edit controls and then choosing
the Add to Custom Colors button to display the new color in
the selected rectangle.
The Color ISolid control displays the dithered and solid colors
that correspond to the user's selection. (A dithered color is a color
created by combining one or more pure or solid colors.) The
Flags member of the CHOOSECOLOR structure contains a flag
bit that, when set, displays a Help button.
An application can display the Color dialog box in one of two
ways: fully open or partially open. When the Color dialog box is
displayed partially open, the user cannot change the custom
colors.
Color models
used by the Color
dialog box
RGB color model
The Color dialog box uses two models for specifying colors: the
RGB model and the HSL model. Regardless of the model used,
internal storage is accomplished by use of the RGB model.
The RGB model is used to designate colors for displays and other
devices that emit light. Valid red, green, and blue values are in
the range 0 through 255, with 0 indicating the minimum intensity
CYAN
RGB values
Red
Green
Blue
Cyan
Magenta
Yellow
White
Black
255,0,
0,255,0
0,0,255
0,255,255
255,0,255
255,255,
255,255,255
0,0,
The Color dialog box provides controls for specifying HSL values.
The following illustration shows the color spectrum control and
the vertical luminosity control that appear in the Color dialog box
and shows the ranges of values the user can specify with these
controls.
240 -
;"""'='===---------.
-240
Luminosity
Saturation
0 - L..-_ _ _ _ _ _ _ _ _----'
Hue
-0
239
HSL values
RGB values
Red
Yellow
Green
Cyan
Blue
Magenta
White
Black
(0,240, 120)
(40,240, 120)
(80,240, 120)
(120,240, 120)
(160,240, 120)
(200,240, 120)
(0,0,240)
(0,0,0)
(255,0,0)
(255,255,0)
(0,255,0)
(0,255,255)
(0,0,255)
(255,0,255)
(255, 255, 255)
(0,0,0)
An application can display the Color dialog box so that a user can
select one color from a list of basic screen colors. This section
describes how you can provide code and structures in your
application that make this possible.
Before you display the Color dialog box you need to initialize a
CHOOSECOLOR structure. This structure should be global or
declared as a static variable. The members of this structure
contain information about such items as the following:
III
Structure size
III
E3
The hook function and custom dialog box template to use for a
customized version of the Color dialog box
If your application does not customize the dialog box and you
want the user to be able to select a single color from the basic
colors, you should initialize the CHOOSECOLOR structure in the
following manner:
/* Color variables * /
CHOOSE COLOR cc;
COLORREF clr;
COLORREF aclrCust[16];
int i;
/* Set the custom color controls to white. * /
for (i = 0; i < 16; i++)
aclrCust[i] = RGB(255, 255, 255);
/* Initialize clr to black. */
clr
RGB (0, 0, 0)
cc.Flags = CC_PREVENTFULLOPENi
if (ChooseColor(&cc))
. /* Use cc.rgbResult to select the user-requested color. */
An application can display the Color dialog box so that the user
can create and select a custom color. This section describes how
you can provide code and structures in your application that
make this possible.
Before you display the Color dialog box, you need to initialize a
CHOOSECOLOR structure. This structure should be global or
declared as a static variable. The members of this structure
contain information about such items as the following:
Structure size
Which window owns the dialog box
Whether the application is customizing the common dialog box
The hook function and custom dialog box template to use for a
customized version of the Color dialog box
RGB values for the custom color control
If your application does not customize the dialog box and you
want the user to be able to create and select custom colors, you
should initialize the CHOOSECOLOR structure in the following
manner:
/ * Color Variables * /
CHOOSE COLOR chsclr;
DWORDdwCustClrs[16]
Calling the
ChooseColor function
10
-..
1m
~..
'~~&~~~YS
~~~~~~ SERIF
I~
.,
1~1Bt1
'1-
Bold
Bold Italic
Italic
AaBbYyZz
Displaying the
Font dialog box in
your application
The Font dialog box appears after you initialize the members in a
CHOOSE FONT structure and call the Choose Font function. This
structure should be global or declared as a static variable. The
members of the CHOOSEFONT structure contain information
about such items as the following:
EI
lJ
lJ
lJ
E1
13
11
2.
3.
4.
5.
6.
12
cf.nFontType = SCREEN_FONTTYFE;
ChooseFont(&cf);
When the user closes the Font dialog box by choosing the OK
button, the ChooseFont function returns information about the
selected font in the LOGFONT structure to which the IpLogFont
member points. An application can use this LOGFONT structure
to select the font that will be used to render text. The following
example selects a font by using the LOG FONT structure and
renders a string of text:
hdc = GetDC(hwnd);
hFont = CreateFontlndirect(cf.lpLogFont);
hFontOld = SelectObject(hdc, hFont);
TextOut(hdc, 50, 150,
"AaBbCcDdEeFfGgHhIiJjKkLIMrnNnOoPpQqRrSsTtUuVvWwXxYyZz" , 52);
SelectObject(hdc, hFontOld);
DeleteObject(hFont);
ReleaseDC(hwnd, hdc);
Displaying the
Open dialog
box in your
application
The Open dialog box appears after you initialize the members of
an OPENFILENAME structure and call the GetOpenFileName
function.
13
Open
File Name:
~ireclories:
In
c:\windows
dcnxcode.wri
hw.wri
iusl.wri
iusl2.wri
mylsl.wri
rev.wri
unischd.wri
unitool.wri
CJ
1.111
.t...
Iii
I
system
1m; HI'
ft.
'$'
I
;W
DRead Only
~c:\
~windows
~
Drives:
II
IliiiI c:
II
14
1.
2.
3.
4.
5.
Set the nMaxFile member to the value that specifies the length
of the filename array.
6.
7.
8.
9.
GetSystemDirectory(szDirName, sizeof(szDirName));
szFile [0] =' \0';
if ((cbString = LoadString(hinst, IDS FILTERSTRING,
szFilter, sizeof(szFilter))) == 0) {
ErrorHandler();
return OL;
chReplace = szFilter[cbString - 1]; /* retrieve wildcard */
for (i = 0; szFilter[i] != '\0'; i++)
if (szFilter[i] == chReplace)
szFilter[i] = '\0';
/* Set all structure members to zero. * /
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.1StructSize = sizeof(OPENFlLENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = szFilter;
ofn.nFilterlndex = 1;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = sizeof(szFileTitle);
ofn.lpstrlnitialDir = szDirName;
ofn.Flags = OFN_SHOWHELP I OFN PATHMUSTEXIST
OFN_FILEMUSTEXIST;
15
if(GetOpenFileName(&ofn)){
hf = _lopen(ofn.lpstrFile, OF_READ);
/* Perform file operations. */
else
ErrorHandler();
END
The vertical bars in this string are used as wildcards. After using
the LoadString function to retrieve the string, the wildcards are
replaced with NULL. The wildcard can be any unique character
and must be included as the last character in the string.
Initializing strings in this manner guarantees that the parts of the
string are contiguous in memory and that the string is terminated
with two null characters.
Applications that can open files over a network can create a new
message identifier for the string defined by the SHAREVISTRING
constant. The application creates the new message identifier by
calling the RegisterWindowMessage function and passing this
constant as the single parameter. After calling
RegisterWindowMessage, the application is notified whenever a
sharing violation occurs during a call to the Open File function.
For more information about processing registered window
messages, see "Using Find and Replace dialog boxes."
Displaying the
Save As dialog
box in your
application
16
The Save As dialog box appears after you initialize the members
of an OPEN FILENAME structure and call the GetSaveFileName
function.
FileName:
I!.irectories:
c:\windows
Irev.wr~
QCflllcode. wri
hW.\'ui
iu~twri
iu~l2.Wli
E3 c:\
e> windows
CJ
I~
~
system
mrhL\wi
liiIIr~1~\%\~
o Read Only
rev.wl'i
uni:;chd. wri
l.mi!nni.w!i
i *:attr,1!;11
Driyes:
II
IIiiiiI c:
char szDirName[256];
char szFile[256], szFileTitle[256];
UINT i, cbString;
char chReplace;
1* string separator for szFilter *1
char szFilter[256];
HFILEhf;
1*
* Retrieve the system directory name, and store it in
* szDirName.
*1
GetSystemDirectory(szDirName, sizeof(szDirName));
if ((cbString = LoadString(hinst, IDS_FILTERSTRING,
szFilter, sizeof(szFilter))) == 0) {
ErrorHandler();
return 0;
chReplace
17
\0' i
ofn.1StructSize = sizeof(OPENFILENAME)i
ofn.hwndOwner = hwndi
ofn.lpstrFilter = szFilteri
ofn.lpstrFile = szFilei
ofn.nMaxFile = sizeof(szFile)i
ofn.lpstrFileTitle = szFileTitlei
ofn.nMaxFileTitle = sizeof(szFileTitle)i
ofn.lpstrInitialDir = szDirNamei
ofn.Flags = OFN_SHOWHELP I OFN_OVERWRITEPROMPTi
if(GetSaveFileName(&ofn)){
/* Perform file operations. */
else
ErrorHandler () i
18
Meaning
CD_LBSELCHANGE
CD_LBSELSUB
CD_LBSELADD
CD_LBSELNOITEMS
Monitoring
filenames in an
Open or Save As
dialog box
19
'-'
Printer:
'I....
"',
111"'ld
Print R a n g e - - - - - - - - ,
o All
o S~lection
@le.~~~:~: ~
Print Q,uality:
I~-10:
II
,!;.opies: ~
Print to File
Choosing the Setup button in the Print dialog box displays the
following Print Setup dialog box for a PostScript printer.
-
Print Setup
1_
1_
P r i n t e r - - - - - - - - - - - - - - - - - , '. . . .
@lti~)'~.~I(.~.I.i~.i.~r.j
(currently Oiconix 150 Plus on LPT1:)
o SpecificE,rinter:
IOiconix 150 Plus on LPT1:
Orientation-----,
rA1
II
Paper
@ Portrait
Si~e:
Source: ITractor
La~dscape
ILetter B 112 x 11 in
II
II
The Print Setup dialog box provides controls that make it possible
for the user to reconfigure the selected printer.
20
Device drivers
and the Print
dialog box
The Print dialog box differs from other common dialog boxes in
that part of its dialog box procedure resides in COMMDLG.DLL
and part in a printer driver. A printer driver is a program that
configures a printer, converts graphics device interface (GD!)
commands to low-level printer commands, and stores commands
for a particular print job in a printer's queue.
A printer driver exports a function called ExtDeviceMode, which
displays a dialog box and its controls. In previous versions of
Windows, an application called the LoadLibrary function to load
a device driver and the GetProcAddress function to obtain the
address of the ExtDeviceMode function. This is no longer
necessary with the Windows common dialog box interface.
Instead of calling LoadLibrary and GetProcAddress, a Windows
application can call a single function, PrintDlg, to display the
Print dialog box and begin a print job. The code for PrintDlg
resides in COMMDLG.DLL. The dialog box that appears when an
application calls PrintDlg differs slightly from the dialog box that
appears when the application calls directly into the device driver.
The functionality is very similar in spite of the different
appearance.
Displaying a Print
dialog box for the
default printer
Ell
tI
The hook function and custom dialog box template to use for a
customized version of the Print dialog box or Print Setup
dialog box
21
2.
3.
1* InitializethenecessaryPRINTDLGstructuremembers. *1
pd.1StructSize = sizeof(PRINTDLG);
pd.hwndOwner = hwnd;
pd. Flags = PD_RETURNDC;
22
Displaying the
Find dialog box
The Find dialog box contains controls that make it possible for a
user to specify the following:
II
1:1
II
II
II
FindWhat:
Find.'
L-Ilh_is_ _ _ _ _ _ _- - > I I _
El
23
2.
3.
If you are customizing the Find dialog box, set the hlnstance
member to identify the instance of the module that contains
your custom dialog box template.
4.
5.
6.
7.
8.
9.
10. If your application uses a custom dialog box template, set the
IpTemplateName member to point to the string that identifies
the template.
24
Displaying
the Replace
dialog box
1:1
13
"
'".
FindWhal:
.: "
r."
-'
L-11e_,,_ _ _ _ _ _ _--'II . . . . .
t8ll~~.I.~~~h~I~.5i1,.~i.~~g.~(j;j
D Malch!;.ase
Replace)'" ".
118111111
1_1
25
Processing dialog
box messages for
a Find or Replace
dialog box
The Find and Replace dialog boxes differ from the other common
dialogs in two respects: First, they are modeless; and second, their
respective dialog box procedures send messages to the
application that calls the FindText or ReplaceText function. These
messages contain data specified by the user in the dialog box
controls, such as the direction in which the application should
search for a string, whether the application should match the case
of the specified string, and whether the application should match
the entire string.
To process messages from a Find or Replace dialog box, an
application must register the dialog box's unique message,
FINDMSGSTRING.
26
Appropriate and
inappropriate
customizations
27
Hook functions
and custom
dialog box
templates
Each common dialog box uses the dialog box procedure and
dialog box template provided for it in COMMDLG.DLL. The
dialog box procedure processes messages and notifications for
the common dialog box and its controls. The dialog box template
defines the appearance of the dialog box-its dimensions, its
location, and the dimensions and locations of controls that appear
within it.
In addition to the provided dialog box procedure and dialog box
template, a custom dialog box requires a hook function that you
provide and, usually, a custom version of the dialog box template.
Hook function
<windows.h>
<commdlg.h>
<string.h>
"header.h"
*/
OPENFILENAME ofn;
/* Get the system directory name, and store in szDirName. */
GetSystemDirectory((LPSTR)szDirName, 255);
/* Initialize the OPENFILENAME members. */
szFile[O] = '\0';
ofn.1StructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.hInstance = hInst;
28
ofn.lpstrFilter = szFilter[O];
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = OL;
ofn.nFilterlndex = lL;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = sizeof(szFileTitle);
ofn.lpstrlnitialDir = szDirName;
ofn.lpstrTitle = NULL;
ofn.Flags = OFN_ENABLEHOOK
OFN_ENABLETEMPLATE;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lpfnHook = MakeProclnstance((FARPROC) FileOpenHookProc, hlnst);
ofn.lpTemplateName = "FileOpen";
29
if (wParam == IDOK) {
/* Set backup flag. */
ofn.1CustData =
(DWORD) IsDlgButtonChecked(hdlg, ID_CUSTCHX);
return FALSE; /* Allow standard processing. */
/* Allow standard processing. */
return FALSE;
This hook function tests a custom check box when the user
chooses the OK button. If the check box was selected, the hook
function sets the ICustData member of the OPEN FILENAME
structure to 1; otherwise, it sets the ICustData member to O.
A hook function should never call the End Dialog function.
Instead, if a hook function contains code that abnormally
terminates a common dialog box, this code should pass the
IDABORT value to the dialog box procedure by using the
PostMessage function as shown in the following example:
PostMessage(hDlg,WM_COMMAND,IDABORT, (LONG)FALSE);
30
'WINSTUB.EXE'
CODE
DATA
HEAPSIZE
1024
STACKSIZE8192
EXPORTS
FILEOPENHOOKPROC
Customizing a dialog
box template
@1
COLOR.DLG
FILEOPEN.DLG
FILEOPEN.DLG
FINDTEXT.DLG
FINDTEXT.DLG
FONT.DLG
PRNSETUP.DLG
PRNSETUP.DLG
Color
Open (single selection)
Open (multiple selection)
Find
Replace
Font
Print
Print Setup
31
86,
50,
WS_GROUP,
12
END
This entry supports the addition of a new Backup File check box
immediately below the existing Read Only check box.
The custom template should be added to the application's
resource file.
Displaying
the custom
dialog box
After your application creates the hook function and the dialog
box template, it should set the members of the structure for the
common dialog box being customized and call the appropriate
function to display the custom dialog box.
The following example calls the GetOpenFileName function and
creates a backup file if the user selected the custom Backup File
check box in the custom Open dialog box:
/* Open the file and create a backup. * /
if(GetOpenFileName(&ofn) ){
hf = _lopen(ofn.lpstrFile, OF_READWRITE);
/* Create the backup file. */
if (ofn.lCustData) {
/* Process files with extension. */
if (ofn.nFileExtension){
for (i=O; iint)ofn.nFileExtension; i++)
szChar[i] = *ofn.lpstrFile++;
}/*endif */
/* Process files without extension. */
else {
i=O;
while (*ofn.lpstrFile!='\O')
szChar[i++] = *ofn.lpstrFile++;
32
*/
The following is the custom Open dialog box. The new Backup
File check box appears in the lower-right corner.
File tiame:
10
3270.txl
nelworks.lxl
prinlers.lxl
readme.lxl
sysini.lxl
sysini2.lxl
sysini3.lxl
winini.lxl
lisl Files of IYpe:
.o.irectories:
c:\windows
If
~ windows
CJ
laillJ
~I'~.
'_1
system
o .!l.ackup File
III.....]
IW_r_il_e_F_ile_s..;...(_.T_X_T_l_____
...
e; c:\
Driyes:
IIiiiiiI c: ioe
I~I
33
Flag value
OPENFILENAME
CHOOSECOLOR
FINDREPLACE
CHOOSEFONT
PRINTDLG
OFN_SHOWHELP
CC_SHOWHELP
FR_SHOWHELP
CF_SHOWHELP
PD_SHOWHELP
34
MyHelpMsg = RegisterWindowMessage(HELPMSGSTRING);
if (message == MyHelpMsg)
WinHelp (hWnd, "appfile.hlp", HELP_CONTEXT, ID_MY_CONTEXT);
When this condition is true, the hook function should call the
WinHelp function as shown in the preceding example. (To process
Error detection
Whenever a common dialog box function fails, an application can
call the CommDlgExtendedError function to find out the cause of
the failure. The CommDlgExtendedError function returns an
error value that identifies the cause of the most recent error.
Six constants are defined in the CDERRH header file that
identify the ranges of error values for categories of errors
returned by CommDlgExtendedError. Following are these
constants in ascending order by value range:
Constant
Meaning
CDERR_GENERALCODES
PDERR_PRINTERCODES
CFERR_CHOOSEFONTCODES
FNERR_FILENAMECODES
35
FRERR_FINDREPLACECODES
CCERR_CHOOSECOLORCODES
36
2
Dynamic Data Exchange
Management Library
This chapter describes how to use the Dynamic Data Exchange
Management Library (DDEML). The DDEML is a dynamic-link
library (DLL) that applications running with the Microsoft
Windows operating system can use to share data.
The following topics are related to the information in this chapter:
III
Atoms
CI
Memory management
II
Clipboard
Dynamic-link libraries
II
37
Basic concepts
The concepts in this section are key to understanding DOE and
the DDEML.
38
Transactions and
the DDE callback
function
39
Service names,
topic names, and
item names
System topic
The System topic provides a context for information that may be
of general interest to any DDE client. Server applications are
encouraged to support the System topic at all times. (The System
topic is defined in the DDEML header file as SZDDESYS_TOPIC.)
To find out which servers are present and the kinds of
information they can provide, a client can request a conversation
on the System topic with the service name set to NULL when the
client application starts. Such wildcard conversations should be
kept to a minimum, because they are costly in terms of system
performance.
For more information about initiating DDE conversations, see
"Conversation management."
40
Description
SZDDE_ITEM_ITEMLIST
SZDDESYS_ITEM_FORMATS
SZDDESYS_ITEM_HELP
SZDDESYS_ITEM_RTNMSG
SZDDESYS_ITEM_STATUS
SZDDESYS_ITEM_SYSITEMS
41
Initialization
The DDEML requires that Windows be running; otherwise, the
system cannot load the DDEML dynamic-link library. Before
calling any DDEML function, an application should call the
GetWinFlags function, checking the return value for the
WF_PMODE flag. If this flag is returned, the application can call
DDEML functions.
Before calling any other DDEML function, an application must
call the Ddelnitialize function. The Ddelnitialize function obtains
an instance identifier for the application, registers the
application's DDE callback function with the DDEML, and
specifies the transaction filter flags for the callback function.
The DDEML uses instance identifiers so that it can support
applications that allow multiple DDEML instances. Each instance
of an application must pass its instance identifier as the idlnst
parameter to any other DDEML function that requires it. An
application that uses multiple DDEML instances should assign a
different DDE callback function to each instance. This makes it
possible for the application to identify each instance within its
callback function.
The purpose for multiple DDEML instances is to support DLLs
using the DDEML. It is not recommended that an application
have multiple DDE instances.
Transaction filters optimize system performance by preventing
the DDEML from passing unwanted transactions to the
application's DDE callback function. An application sets the
transaction filters when it calls the Ddelnitialize function. An
application should specify a transaction filter flag for each type of
transaction that it does not process in its callback function. An
application can change its transaction filters with a subsequent
call to the Ddelnitialize function.
For more information about transactions, see "Transaction
management."
42
/* instance identifier
*/
/* instance handle
*/
/* procedure instance address */
/*
/*
/*
/*
*/
*/
*/
*/
Callback function
An application that uses the DDEML must provide a callback
function that processes the DOE events that affect the application.
The DDEML notifies an application of such events by sending
transactions to the application's DOE callback function. The
transactions that a callback function receives depend on the
43
switch (wType) {
case XTYP REGISTER:
case XTYP UNREGISTER:
44
String management
Many DDEML functions require access to strings in order to carry
out a DDE task. For example, a client must specify a service name
and a topic name when it calls the DdeConnect function to
request a conversation with a server. An application specifies a
string by passing a string handle rather than a pointer in a
DDEML function. A string handle is a doubleword value,
assigned by the system, that identifies a string.
An application can obtain a string handle for a particular string
by calling the DdeCreateStringHandle function. This function
registers the string with the system and returns a string handle to
the application. The application can pass the handle to DDEML
functions that need to access the string. The following example
obtains string handles for the System topic string and the
service-name string:
HSfuszServName;
HSfuszSysTopic;
hszServNameDdeCreateStringHandle(
idlnst,
/* instance identifier */
"MyServer",
/* string to register */
CP_WINANSI);
/* code page
*/
hszSysTopi~deCreateStringHandle(
idlnst,
/* instance identifier */
SZDDESYS_TOPIC, /* System topic
*/
CP_WINANSI);
/* code page
*/
45
46
Name service
The DDEML makes it possible for a server application to register
the service names that it supports and to prevent the DDEML
from sending XTYP_CONNECT transactions for unsupported
service names to the server's DOE callback function. The
remaining topics in this section describe this service.
Service-name
registration
47
Service-name
filter
Conversation management
A conversation between a client and a server is always
established at the request of the client. When a conversation is
established, each partner receives a handle that identifies the
conversation. The partners use this handle in other DDEML
functions to send transactions and manage the conversation.
A client can request a conversation with a single server, or it can
request multiple conversations with one or more servers. The
remaining topics in this section describe how an application
establishes conversations and explain how an application can
obtain information about conversations that are already
established.
Single
conversations
48
*/
*/
*/
*/
if (hConv == NULL)
MessageBox(hwndParent, "MyServer is unavailable.",
(LPSTR) NULL, ME_OK);
return FALSE;
49
*1
*1
*1
*1
*1
50
* structures.
*/
j
0;
/*
*/
return DdeCreateDataHandle(
idInst,
/* instance identifier
&ahp,
/* points to HSZPAIR array
sizeof(HSZ) * j, /* length of the array
0,
/* start at the beginning
NULL,
/* no item-name string
fmt,
/* return the same format
0) ;
/* let the system own it
*/
*/
*/
*/
*/
*/
*/
51
Multiple
conversations
52
/*
/*
/*
/*
/*
/*
/*
conversation list
instance identifier
System topic
conversation handle
holds conversation data
count of conv. handles
point to string handles
*/
*/
*/
*/
*/
*/
*/
!=NULL) eConv++;
DdeDisconnectList(hconvList);
53
Data management
Because DDE uses global memory to pass data from one
application to another, the DDEML provides a set of functions
that DDE applications can use to create and manage global
memory objects.
All transactions that involve the exchange of data require the
application supplying the data to create a local buffer containing
the data and then to call the DdeCreateDataHandle function. This
function allocates a global memory object, copies the data from
the buffer to the memory object, and returns a data handle of the
application. A data handle is a doubleword value that the
DDEML uses to provide access to data in the global memory
54
char szBuf[32];
switch (wType) {
case XTYP ADVREQ:
if ((hsz1 == hszTime && hsz2 == hszNow)
&& (wFmt == CF_TEXT)) {
/* Copy formatted time string to buffer. */
itoa(tmTime.hour, szBuf, 10);
strcat(szBuf, ":");
if (tmTime.minute < 10)
strcat (szBuf, "0");
itoa(tmTime.minute, &szBuf[strlen(szBuf)], 10);
strcat(szBuf, ":");
if (tmTime.second < 10)
strcat(szBuf, "0");
itoa(tmTime.second, &szBuf[strlen(szBuf)], 10);
szBuf[strlen(szBuf)] = '\0';
/* Create global object, and return data handle. */
55
return (DdeCreateDataHandle(
idlnst,
/* instance identifier
(LPBYTE) szBuf,
/* source buffer
strlen(szBuf) + 1, /* size of global object
OL,
/* offset from beginning
hszNow,
/* item-name string
CF_TEXT,
/* clipboard format
0));
/* no creation flags
*/
*/
*/
*/
*/
*/
*/
else
return (HDDEDATA) NULL;
56
Transaction management
After a client has established a conversation with a server, the
client can send transactions to obtain data and services from the
server. The remaining topics in this section describe the types of
transactions that clients can use to interact with a server.
Request
transaction
57
Poke transaction
A client can send unsolicited data to a server by using the
DdeClientTransaction function to send an XTYP_POKE
transaction to a server's callback function.
The client application first creates a buffer that contains the data
to send to the server and then passes a pointer to the buffer as a
parameter to the DdeClientTransaction function. Alternatively,
the client can use the DdeCreateDataHandle function to obtain a
data handle that identifies the data and then pass the handle to
DdeClientTransaction. In either case, the client also specifies the
topic name, item name, and data format when it calls
DdeCI ientTransaction.
58
Advise
transaction
process the new data. This can be a problem for a client that must
perform long processing operations on the data. In this case, the
59
Execute
transaction
60
Synchronous and
asynchronous
transactions
61
Transaction
control
62
way that it can obtain and return the result without reprocessing
the transaction.
An application can suspend all transactions associated with a
specific conversa-tion handle by specifying the handle and the
EC_DISABLE flag in a call to the DdeEnableCallback function. By
specifying a NULL handle, an application can suspend all
transactions for all conversations.
When a conversation is suspended, the DDEML saves
transactions for the conversation in a transaction queue. When
the application reenables the conversation, the DDEML removes
the saved transactions from the queue, passing each transaction
to the appropriate callback function. Even though the capacity of
the transaction queue is large, an application should reenable a
suspended conversation as soon as possible to avoid losing
transactions.
An application can resume usual transaction processing by
specifying the EC_ENABLEALL flag in the DdeEnableCallback
function. For a more controlled resumption of transaction
processing, the application can specify the EC_ENABLEONE flag.
This removes one transaction from the transaction queue and
passes it to the appropriate callback function; after the single
transaction is processed, any conversations are again disabled.
Transaction
classes
Class
Return value
Transaction
TRUE or FALSE
XTYP_ADVSTART
XTYP_CONNECT
XTYP_ADVREQ XTYP_REQUEST
XTYP _WILDCONNECT
63
Class
Return value
Transaction
XTYP_ADVDATA
XTYP_EXECUTE XTYP_POKE
XCLASS_NOTIFICATION
Transaction
summary
XTYP_ADVSTOP
XTYP_CONNECT_CONFIRM
XTYP_DISCONNECT
XTYP_E;RROR XTYP_REGISTER
XTYP_UNREGISTER
XTYP_XACT_COMPLETE
The following list shows each DDE transaction type, the receiver
of each type, and a description of the activity that causes the
DDEML to generate each type:
Transaction type
Receiver
Cause
XTYP_ADVDATA
Client
A server responded to an
XTYP_ADVREQ
transaction by returning
a data handle.
A server called the
Server
DdePostAdvise
Server
Server
Server
64
Transaction type
Receiver
Cause
XTYP_CONNECT_CONFIRM
Server
XTYP_DISCONNECT
Client/
Server
XTYP_ERROR
Client/
Server
XTYP_EXECUTE
Server
XTYP_MONITOR
DDE
monitoring
application
XTYP_POKE
Server
XTYP_REGISTER
Client/
Server
XTYP_REQUEST
Server
XTYP_UNREGISTER
Client/
Server
65
Transaction type
Receiver
Cause
XTYP_WILDCONNECT
Server
XTYP_XACT_COMPLETE
Client
function, specifying
NULL for the service
name, the topic name, or
both.
An asynchronous
transaction, sent when
the client specified the
TIMEOUT_ASYNC flag
in a call to the
DdeClientTransaction
function, has
concluded.
Error detection
Whenever a DDEML function fails, an application can call the
DdeGetLastError function to determine the cause of the failure.
The DdeGetLastError function returns an error value that
specifies the cause of the most recent error.
Monitoring applications
Microsoft Windows DDESpy (DDESPY.EXE) monitors DDE
activity in the system. You can use DDESpy as a tool for
debugging your DDE applications.
You can use the API elements of the DDEML to create your own
DDE monitoring applications. Like any DDEML application, a
DDE monitoring application contains a DDE callback function.
The DDEML notifies a monitoring application's DDE callback
function whenever a DDE event occurs, passing information
about the event to the callback function. The application typically
displays the information in a window or writes it to a file.
To receive notifications from the DDEML, an application must
have registered itself as a DDE monitor by specifying the
66
Meaning
MF_CALLBACKS
MF_CONV
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
instance identifier
points to callback function
this is a monitoring application
monitor callback functions
monitor conversation data
monitor DDEML errors
monitor data-handle activity
monitor advise loops
monitor posted DDE messages
monitor sent DDE messages
reserved
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
return FALSE;
67
Description
MONCBSTRUCT
MONCONVSTRUCT
MONERRSTRUCT
MONLINKSTRUCT
MONHSZSTRUCT
MONMSGSTRUCT
LPVOID lpData;
char *szAction;
char buf [256] ;
DWORD cb;
switch (wType)
case XTYP MONITOR:
/* Obtain a pointer of the global memory object. */
if (lpData = DdeAccessData(hData, &cb))
/* Examine the monitor flag. */
68
switch (dwData2) {
case MF HSZ INFO:
#definePHSZS((MONHSZSTRUCTFAR*)lpData)
1*
* The global memory object contains
* string-handle data. Use the MONHSZSTRUCT
* structure to access the data.
*1
switch (PHSZS->fsAction) {
1*
* Examine the action flags to determine
* the action performed on the handle.
*/
case MH CREATE:
szAction = "Created";
break;
case MH KEEP:
szAction
break;
"Incremented";
case MH DELETE:
szAction = "Deleted";
break;
case MH CLEANUP:
szAction = "Cleaned up";
break;
default:
DdeUnaccessData(hData);
return ((HDDEDATA) 0);
69
70
3
Object linking and
embedding libraries
This chapter describes the implementation of object linking and
embedding (OLE) for applications that run with the Microsoft
Windows operating system. The chapter also describes how an
application can use linked and embedded objects to create
compound documents. The following topics are related to the
information in this chapter:
III
EI
Clipboard
II
Registration database
13
Dynamic-link libraries
\I
This chapter does not go into detail about the recommended user
interface for applications that use linked and embedded objects.
71
Compound
documents
72
-I
Cha rt Server
-I
Cut or
Copy
[i
Clipboard
[i]
-I
~ abc.doc
Copy
OK
r--
o To Clipboard
Paste,
Paste Link, or
Paste Special
Copy
Client
File Manager
Insert Object
:;;::;;::;;::;;::;;::;;::;;:
.-
Paste,
"-- ~ abc.doc
Paste Link,
~ xyz.doc
or Paste
U
Special
:::.:::.:::,:::.:::.:::.:::. abc.doc
-I Insert
Object
xyz.doc
Select
table object
from list.
OK
-I
Drag and
Drop
Update or Exit
Tabl e Server
Linked and
embedded
objects
73
in some other file and only a link to the data would be saved with
the text file.
If an object is embedded, all the data associated with it is saved as
part of the file in which it is embedded. If a range of spreadsheet
cells were embedded in a text file, the data in the cells would be
saved with the text file, including any necessary formulas; the
name of the server for the spreadsheet cells would be saved along
with this data. The user could select this embedded object while
working with the text file, and the spreadsheet application would
be started automatically for editing those cells. The presentation
and the behavior of the data is the same for a linked and an
embedded object.
Packages
Verbs
74
Benefits of object
linking and
embedding
EI
I'l
75
Choosing
between OLE
and the DDEML
Description
Extensibility to future
enhancements
76
Advantage
Description
Rendering of common
data formats
Ii3
77
items and, optionally, that the server send the data when the
change occurs .
Sending data from a server to a client.
Poking data from a client to a server.
Sending a DOE command. (This is supported by the
Ole Execute function.)
An OLE client application receives a pointer to an OLEOBJECT
structure; this structure includes class name, document name,
and item name information. These names correspond exactly to
DOE counterparts, as follows:
OLE name
DOE name
Class name
Document name
Item name
DOE message
OleExecute
OleRequestData
OleSetData
WM_DDE_EXECUTE
WM_DDE_REQUEST
WM_DDE_POKE
78
79
Client
applications
Server
applications
An OLE server is any application that can edit an object when the
OLE libraries inform it that the user of a client application has
selected the object. (Some servers can perform operations on an
object other than editing.) When the user double-clicks an object
in a client application, the server associated with that object starts
and the user works with the object inside the server application.
When the server starts, its window is typically sized so that only
the object is visible. If the user double-clicks a linked object, the
entire linked file is loaded and the linked portion of the file is
selected. For embedded objects, the user chooses the Update
command from the File menu to save changes to the object and
chooses Exit when finished.
Many applications are capable of acting as both clients and
servers for linked and embedded objects.
Object handlers
Some OLE server applications implement an additional kind of
OLE library called an object handler. Object handlers are
dynamic-link libraries that act as intermediaries between client
and server applications. Typically, an object handler is supplied
by the developers of a server application as a way of improving
performance. For example, an object handler could be used to
redraw a changed object if the presentation data for that object
could not be rendered by the client library.
80
Communication
between OLE
libraries
Client applications use functions from the OLE API to inform the
client library, OLECLI.DLL, that a user wants to perform an
operation on an object. The client library uses DOE messages to
communicate with the server library, OLESVR.DLL. The server
library is responsible for starting and stopping the server
application, directing the interaction with the server's callback
functions, and maintaining communication with the client library.
When a server application modifies an embedded object, the
server notifies the server library of changes. The server library
then notifies the client library, and the client library calls back to
the client application, informing it that the changes have
occurred. Typically, the client application then forces a repaint of
the embedded object in the document file. If the server changes a
linked object, the server library notifies the client library that the
object has changed and should be redrawn.
Clipboard
conventions
81
defined for that class of data. Native data cannot be used twice in
the definition of an object, however; if the server puts Native and
OwnerLink data on the clipboard to describe an embedded
object, it cannot use Native data as a presentation format for that
object. The ability of object handlers to use Native data as the
presentation data accounts for the significance of the order of the
formats: the order is the only way to distinguish between an
embedded object and a link that uses Native data for its
presentation.
ObjectLink data identifies a linked object's class and document
and the item that is the source for the linked object. (If the item
name specified in the ObjectLink format is NULL, the link refers
to the entire server document.)
The following table describes the contents of the ObjectLink,
OwnerLink, and Native clipboard formats:
Format name
Contents
ObjectLink
OwnerLink
Native
82
The order in which various data formats are put on the clipboard
depends on the type of data being copied to the clipboard and the
capabilities of the server application. The following table shows
the order of clipboard data formats for four different types of data
selections. An object does not necessarily use all of the formats
listed for it.
Source selection
Embedded object
Native
OwnerLink
Picture or other presentation format (optional)
ObjectLink (included only if the server also
supports
links)
OwnerLink
Picture or other presentation format (optional; for
linked objects, this can be Native data)
ObjectLink
A pplica tion-specific formats
Native
OwnerLink
Picture
ObjectLink
Structured data formats (if selection is structured
data only)
Native
OwnerLink
Picture, text, and so on
ObjectLink
Linked object
Pictorial data
Structured da ta
83
84
Registration
The registration database supports linked and embedded objects
by providing a systemwide source of information about whether
server applications support the OLE protocol, the names of the
executable files for these applications, the verbs for classes of
objects, and whether an object-handler library exists for a given
class of object.
When a server application is installed, it registers itself as an OLE
server with the registration database. (This database is supported
by the dynamic-link library SHELL.DLL.) To register itself as an
OLE server, a server application records in the database that it
supports one or more OLE protocols. The only protocols
supported by version l.x of the Microsoft OLE libraries are
StdFileEditing and StdExecute. StdFileEditing is the current
protocol for linked and embedded objects. StdExecute is used
only by applications that support the Ole Execute function. (A
third name, Static, describes a picture than cannot be edited by
using standard OLE techniques.)
When a client activates a linked or embedded object, the client
library finds the command line for the server in the database,
appends the IEmbedding or IEmbedding filename command-line
option, and uses the new command line to start the server.
Starting the server with either of these options differs from the
user starting it directly. Either a slash (j) or a hyphen (-) can
precede the word Embedding. For details about how a server
reacts when it is started with these options, see "Opening and
closing objects."
The entries in the registration database are used whenever an
application or library needs information about an OLE server. For
example, client applications that support the Insert Object
command refer to the database in order to list the OLE server
applications that could provide a new object. The client
application also uses the registration database to retrieve the
name of the server application for the Paste Special dialog box.
Registration database
85
Servers that support the Ole Execute function also add the
following line to the database:
HKEY_CLASSES_ROOT\class name \ protocol \StdExecute \server
executable file name
86
A server can register the entire path for its executable file, rather
than registering only the filename and arguments. Registering
only the filename fails if the application is installed in a directory
that is not mentioned in the PATH environment variable.
Usually, registering the path and filename is less ambiguous than
registering only the filename.
Servers can register data formats that they accept on calls to the
OleSetData function or that they can return when a client calls the
OleRequestData function. Clients can use this information to
initialize newly created objects (for example, from data selected in
the client) or when using the server as an engine (for example,
when sending data to a chart and getting a new picture back).
Client applications should not depend on the requested data
format, because the calls can be rejected by the server.
In the following example, format is the string name of the format
as passed to the RegisterClipboardFormat function or is one of
the system-defined clipboard formats (for example,
CF_METAFILEPICT):
HKEY_CLASSES_ROOT \ class name \ protocol \StdFileEditing
\SetDataFormats = format[,format]
HKEY_CLASSES_ROOT \ class name \ protocol \StdFileEditing
\RequestDataFormats = format[,format]
Version control
for servers
87
Client user
interface
88
Command
Description
Copy
Cut
Paste
Paste Link
Links
Insert Object
Paste Special
The Class Name Object command allows the user to choose one of
an object's verbs. If the selection in the document is an embedded
object, the Class Name placeholder is typically replaced by the
89
90
start Microsoft Excel, and use the Microsoft Excel Cut or Copy
command to transfer data to the clipboard. After returning to the
client application, the user could choose the Paste command to
move the data from the clipboard into the text document.
If the user chooses the Undo command after activating an object,
all the changes made since the object was last updated (or since
the object was activated, if it has not been updated) are discarded
and the object returns to its state prior to the update. The Undo
command closes the connection to the server.
Using packages
IJ
Drag a file from File Manager and drop it in the open window
for a document in a client application.
IJ
IJ
A user whose system does not include the Windows version 3.1
File Manager can follow these steps to create a package by using
Object Packager:
IJ
IJ
Open Object Packager and paste the data into it. (At this point,
the user could modify the default icon, the default label
identifying the icon, or both.)
91
Server user
interface
Description
Cut
Copy
92
When an embedded object is edited or played by a multipleinstance server-that is, a server that does not support the
multiple document interface (MDI), the Save command on the
File menu should change to Update. (This change does not occur
when a server starts for a linked object.) When the user chooses
the Update command, the object in the client is updated but the
focus remains with the server window. To close the server
window, the user chooses the Exit command.
When the user chooses the Save As, New, or Open command, the
application should display a warning message asking the user
whether to update the object in the compound document before
performing the action. The New and Open commands break the
link between the client and server applications. The Save As
command also breaks the link between the client and server if the
server was editing an embedded object.
Updating objects from
single-instance servers
Object storage
formats
Il
Description
LONG
Variable
93
The following list gives the storage format for the standard
presentation object used for linked and embedded objects. The
items appear in the order listed.
Type
Description
LONG
LONG
Variable
LONG
LONG
LONG
Variable
The following list gives the storage format for the generic
presentation object used for linked and embedded objects.
Generic objects are used when the clipboard format is other than
metafile, bitmap, or DIB. The items appear in the order listed.
Type
Description
LONG
LONG
Variable
LONG
LONG
LONG
Variable
The following list gives the storage format for embedded objects.
The items appear in the order listed.
Type
Description
LONG
LONG
Variable
Variable
Variable
LONG
Variable
Variable
94
The following list gives the storage format for linked objects. The
items appear in the order listed.
Type
Description
LONG
LONG
Variable
Variable
Variable
Variable
short
short
LONG
Variable
The following list gives the storage format for static objects. The
only difference between the format for static objects and the
format for standard presentation objects is the value of the format
identifier. The items appear in the order listed.
Type
Description
LONG
LONG
Variable
LONG
LONG
LONG
Variable
Client applications
A client application uses a server application to activate and
render an object contained by a compound document. A client
application provides storage for embedded objects, such
contextual information as the target printer and page position,
and a means for the user to activate the object and the server
application associated with that object. Client applications also
provide ways of putting embedded and linked objects into a
document and taking them out again.
95
Starting a client
application
2.
3.
96
Opening a
compound
document
2.
3.
4.
List any objects with manual links so that the user can update
them. Automatically update any automatic links.
97
Document
management
Description
OleRegisterClientDoc
OleRenameClientDoc
OleRevertClientDoc
OleRevokeClientDoc
OleSavedClientDoc
98
Saving a
document
2.
3.
When the library confirms that all objects have been saved,
call the OleSavedClientDoc function.
Closing a
document
Asynchronous
operations
For each object in the document, call the Ole Release function.
2.
3.
When the library confirms that all objects have been closed,
call the OleRevokeClientDoc function.
99
100
OLE_BUSY
Yes
Yes
Yes
No
No
No
No
No
No
Yes
Yes
OleLoadFromStream
No
OleObjectConvert
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
OleReconnect
OleRelease
OleRequestData
OleSetBounds
OleSetColorScheme
OleSetData
OleSetHostNames
OleSetLinkUpdateOptions
OleSetTargetDevice
OleUnlockServer
No
OleUpdate
Yes
OLE_WAIT_FOR_RELEASE
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
101
Displaying and
printing objects
Opening and
closing objects
102
Deleting objects
To permanently delete an object from a document, the client
should call the Ole Delete function. OleDelete closes the specified
object, if necessary, before deleting it.
103
2.
3.
4.
5.
6.
104
the Ole Release function to free the memory for the cloned object.
When the selection has been saved to the stream, the application
can call the SetClipboardData function. If SetClipboardData is
successful, the application should call the OleSavedClientDoc
function. The application then calls the OleRevokeClientDoc
function, specifying the handle retrieved by the call to
OleRegisterClientDoc. For more information about the Cut and
Copy commands, see "Server Cut and Copy commands."
Creating objects
A client application can put linked and embedded objects in a
document by pasting them from the clipboard, creating them
from a file, copying them from other objects, or by starting a
server application to create them directly.
Object-creation
functions
Description
OleClone
OleCopyFromLink
OleCreate
OleCreateFromClip
OleCreateFromFile
OleCreateFromTemplate
OleCreatelnvisible
OleCreateLinkFromClip
OleCreateLinkFromFile
OleObjectConvert
105
should use the registration database to find out what OLE servers
are available and then list those servers for the user. When the
user selects one of the servers and chooses the OK button, the
client can use the OleCreate function to create an object at the
current position.
The OleCopyFromLink, OleCreate, and OleCreateFromTemplate
functions always create an embedded object. The other
object-creation functions can create either an embedded object or
a linked object, depending on the order and type of available
data.
If a client application's callback function receives the
106
2.
Il
If the user chooses Paste Link, open the clipboard and call
the OleCreateLinkFromClip function.
3.
4.
The client application should put the pasted data or object into
the document at the current position. The client should select the
object so that the user can work with it immediately. If both the
OleQueryCreateFromClip and OleQueryLinkFromClip functions
fail but there is data on the clipboard that the client can interpret,
the client should enable the Paste command.
If the information on the clipboard is incomplete-for example, if
Native data is not accompanied by the OwnerLink format-the
Paste command should insert a static object into the document. (A
static object consists of the presentation data for an object; it
cannot be edited by using standard OLE techniques. Attempts to
open static objects fail and generate no notifications.)
If the client application implements the Paste Special command, it
should use the EnumClipboardFormats function to produce a list
of data formats on the clipboard. The client should also check the
107
Undo command
A client application can use the OleClone function to support the
Undo command. A cloned object is identical to the original except
for connections to the server application; the cloned object is not
automatically connected to the server. When the server is closed
and the object is updated, the saved copy of the object gives the
user the opportunity to undo all of the changes made in the
server. Support for the Undo command is provided by the client
application, because the server cannot maintain a record of the
prior states of objects.
The Undo command restores an object to its condition prior to the
last update from the server. To support this behavior, the client
application must clone the object when it is first activated and
then clone the updated object when an update occurs; the client
must maintain two clones of the object. The clone of the original
object must be maintained so that an updated object can be
restored if the user chooses the Undo command. The clone of the
updated object must be maintained to support the Undo
command if the updated object is updated again. Because the
data changes when the update occurs, the clone for supporting
the Undo command must be made before any updates occur.
Because the client application cannot distinguish between
different types of object activation, the client must clone an object
for verbs that do not edit the object, even though no updates can
occur in those cases.
108
Class Name
Object command
Links command
When a user chooses the Links command, a dialog box appears
listing every linked object in the document. The selected links are
highlighted in the dialog box. The dialog box makes it possible
for the user to invoke the verbs for an object, select whether link
updating should be automatic or manual, update a link
immediately, cancel a link, and repair broken links.
The Links dialog box includes buttons that allow the user to
activate the primary and secondary verbs for an object. A client
application can implement these buttons by using the OleActivate
function.
A client application can use the OleGetLinkUpdateOptions and
OleSetLinkUpdateOptions functions to support the link-update
radio buttons in the Links dialog box. The following are the three
possible update options:
Option
Description
oleupdate_always
oleupdate_onsave
oleupdate_oncall
109
A user's choosing the Cancel Link button in the Links dialog box
changes an object into a picture that an application cannot edit by
using standard OLE techniques. An application can implement
the Cancel Link button by using the OleObjectConvert function.
A client application should activate the Change Link button in the
Links dialog box only if all the selected links are to the same
source document. When the client has the correct information, it
can repair the link by using the OleGetData and OleSetData
functions. To retrieve the link information for an object, a client
can call the OleGetData function, specifying the ObjectLink
format. (The call to OleGetData fails if ObjectLink is specified and
the object is not a link.) A client can retrieve class information by
using OleGetData and specifying either the OwnerLink format
(for embedded objects) or the ObjectLink format (for linked
objects). The client can make it possible for the user to edit the
link information and store it in the object by using the OleSetData
function, specifying the ObjectLink format.
Closing a client
application
110
Server applications
An OLE server supplies functions that the server library calls
when a user works with an object. The server library,
OLESVR.DLL, uses DOE commands to communicate with the
client library. When the client application calls one of the
functions in the OLE API, the client library informs the server
library and the server library routes the request to the
appropriate function in the server-supplied list of function
pointers.
In addition to the specialized functions that the server creates and
which are called by the server library, there are ten OLE functions
that allow a server to control the library's ability to gain access to
the server and the documents and objects it controls:
Function
Description
OleBlockServer
OleRegisterServer
OleRegisterServerDoc
OleRenameServerDoc
OleRevertServerDoc
OleRevokeObject
OleRevokeServer
OleRevokeServerDoc
OleSavedServerDoc
OleUnblockServer
111
Starting a server
application
2.
3.
4.
5.
6.
112
113
Opening a
document or
object
114
2.
3.
If the server cuts data onto the clipboard, rather than copying it,
the server typically does not offer ObjectLink or Link formats,
because the source for the data has been removed from the
document.
The server should put data on the clipboard in the order given in
"Clipboard conventions."
Typically, the server puts server-specific formats, Native format,
OwnerLink format, and presentation formats on the clipboard. If
it can support links, the server also puts ObjectLink format and,
when appropriate, Link format on the clipboard. The server must
provide a presentation format (CF_METAFILE, CF_BITMAP, or
CF_OIB) if the server does not have an object handler. Native
data can be used as a presentation format only if the server has an
object handler that can use the Native data.
If a user copies onto the clipboard a selection that includes an
embedded object or a link, the data formats the server should
copy depend upon whether the container document modifies the
115
object or link. If the document does not modify the object or link,
the best formats are the Native and OwnerLink formats from the
original source of the object. If the document modifies the object
or link-for example, by recoloring it-the best formats are the
Native and OwnerLink formats from the container document.
If a server uses a metafile as the presentation format for an object,
the mapping mode for that metafile must be
MM_ANISOTROPIC. When a server application uses fonts in
these metafiles, it can improve performance by using TrueType
fonts. (Metafiles scale better when they use TrueType fonts.) To
use TrueType fonts exclusively, the server should set bit 2 (04h)
of the IpPitchAndFamily member of the LOGFONT structure.
116
Condition
TRUE
TRUE
OLESERVERVTBL.
TRUE
FALSE
FALSE
Closing a server
application
117
When the user closes a server that has edited an embedded object
without updating changes to the client application, the server
should display a message asking whether to save the changes. If
the user chooses to save the changes, the server should send the
OLE_CLOSED notification and call the OleRevokeServerDoc
function. (Because sending OLE_CLOSED prompts the server
library to send data to the client library, it is not necessary to send
OLE_CHANGED or OLE_SAVED. If the user chooses not to save
the changes, the server should simply call the OleRevokeServerDoc function (without sending OLE_CLOSED).
A server can use the OleRevokeObject function to revoke a
client's access to an object-for example, if the user destroys the
object. Similarly, the OleRevokeServerDoc function revokes a
client's access to a document. (Because OleRevokeServerDoc
revokes a client's access to all objects in a document, an
application that uses OleRevokeServerDoc does not need to call
the OleRevokeObject function for objects in that document.) To
terminate all conversations with client applications, the server can
call the OleRevokeServer function. These functions inform the
server library that the specified items are no longer available.
A server application can receive
OLE_WAIT_FOR_RELEASE-for example, the
OleRevokeServerDoc function can return this value. Although a
server can enter a message-dispatch loop and wait for the library
to call the server's Release function, servers should never enter
message-dispatch loops inside any of the server-supplied
functions that are called by the server library.
The client application should not instruct the server to close the
document or exit when the server is editing a linked object, unless
the server is updating the link without displaying the object to the
user. Because a linked object exists independently of the client,
the user controls saving and closing the document by using the
server application.
118
Object handlers
An application developer can use object handlers to introduce
customized features into implementations of linked and
embedded objects. When an object handler exists for a class of
object, the object handler supplants some or all of the
functionality that is usually provided by the client library and the
server application. The object handler can take specialized action
for any of the functions it intercepts. The object handler passes
functions that it does not take action on to the client library,
which then implements the default processing for that class.
An application might use an object handler to render Native data
as the presentation data for an object, instead of using metafiles or
bitmaps. Object handlers could also be used to implement special
behavior when an object is opened.
Implementing
object handlers
119
OleCreate
OleCreateFromClip
OleCreateFrom File
OleCreateFromTemplate
OleCreateLinkFromCllp
OleCreateLinkFrom File
OleLoadFromStream
DefCreate
DefCreateFromClip
DefCreateFromFile
DefCreateFromTemplate
DefCreateLinkFromClip
DefCreateLinkFromFile
DefLoadFromStream
120
*/
*/
*lpobj->lpvtbl->Draw = DllDrawi
OLESTATUSFARPASCALDllDraw(lpObject,hdc,lpBounds,lpWBounds,
hdcFormat)
LPOLEOBJECT
lpObjecti
HDC
hdci
LPRECT
LPRECT
lpBoundsi
lpWBoundsi
hdcFormati
HDC
{
*/
121
Creating objects
in an object Most of the object-creation functions in the OLE API work in
exactly the same way when they are renamed and used by
handler object-handler DLLs. Two functions are somewhat different,
however: OleCreateFromClip and OleLoadFromStream.
DefCreateFromClip and
DllCreateFromClip
/*
/*
/*
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
*/
*/
*/
122
*/
*/
*/
*/
*/
*/
*/
*/
*/
123
Client
applications and
direct use of
Dynamic Data
Exchange
124
Linked object:
WM_DDE_INITIATE class name, document name
if not found {
/*
/*
* Now there is a conversation with the correct document.
*/
125
Embedded object:
WM_DDE_INITIATE class name, OLESystem
if not found {
WM_DDE_INITIATE class name, System
if not found {
launch application name, /Embedding
fLaunched = true
WM_DDE_INITIATE class name, OLESystem
if not found {
WM_DDE_INITIATE class name, System
if not found
return error
/*
* Now there is a conversation with the server on the system or
* OLESystem topic.
*/
DDE_EXECUTE StdEditDocument(DocumentNarne)
/*
* Or StdCreateDoc if this is an Insert Object command
*/
WM_DDE_INITIATE class name, document name
if not found {
/* clean up */
if(fLaunched) DDE_EXECUTE StdExit
return error
126
Server
applications and
direct use of
Dynamic Data
Exchange
Multiple-instance application:
case WM_DDE_INITIATE:
if class name == this class {
if (DocumentName == OLESystem I I DocumentName ==
System) {
if no documents are open
WM_DDE_ACK
else if DocumentName == name of some open document
WM_DDE_ACK
127
Conversations
Document operations are performed during conversations with
an application's OLESystem or System topic. The document's
class name is used to establish the conversation.
Data transfer and negotiation operations are performed during
conversations with the document (that is, the topic). The
document name is used to establish the conversation.
Note that the topic name is used only in initiating conversations
and is not fixed throughout the conversation; permitting the
document to be renamed does not mean that there will be two
names. Therefore, it is reasonable to tie the topic name to the
document name.
128
Standard item
names and
notification
control
Description
StdDocumentName
EditEnvltems
StdHostNames
struct {
WORD clientNameOffseti
WORD documentNameOffseti
BYTE data [ 1i
}StdHostNames i
129
Item
Description
StdTargetDevice
StdDocDimensions
StdColorScheme
null
itemnamelupdate type
130
Meaning
/Change
/Close
/Save
Standard
commands in The syntax for standard commands sent in execute strings is the
same as for other DDE commands:
DDE execute
strings command(argumentl,argument2, ...)[command2 (argumentl ,argument2, .. .)J
Commands without arguments do not require parentheses. String
arguments must be enclosed in double quotes.
International execute
commands
II
The server library must receive the U.S. form for these
commands.
1\1
131
132
StdEditDocument(DocumentName)
Creates a document with the given name and prepares to
accept data that is poked into it with WM_DDE_POKE. The
server should return an error if the document name is already
in use. When the client receives this error, it should generate
another name and try again.
The server should not show the window until it receives a
StdShowltem command. Waiting for the client to send a
StdShowltem command makes it possible for the client to
negotiate additional parameters (for example, by using
StdTargetDevice) without forcing the window to repaint.
StdOpenDocument(DocumentName)
Sent to the System topic. This command opens an existing
document with the given name.
The server should not show the window until it receives a
StdShowltem command. Waiting for the client to send a
StdShowltem command makes it possible for the client to
negotiate additional parameters (for example, by using
StdTargetDevice) without forcing the window to repaint.
StdCloseDocument(DocumentName)
Sent to the System topic. This command closes the window
associated with the document. Following acknowledgment, the
server terminates any conversations associated with the
document. The server should not activate the window while
closing it.
StdShowltem(DocumentName, ItemName [, fDoNotTakeFocusJ)
Sent to the System topic. This command makes the window
containing the named document visible and scrolls to show the
named item (if any). The optional third argument indicates
whether the server should take the focus and bring itself to the
front. This argument should be TRUE if the server should not
take the focus; otherwise, it should be FALSE. The default
value is FALSE.
StdExit
133
Variants on required
commands
134
4
Functions
AbortDoc
Syntax
3. 1
int AbortDodhdc)
function AbortDoc(DC: HDC): Integer;
The AbortDoc function terminates the current print job and erases
everything drawn since the last call to the StartDoc function. This function
replaces the ABORTDOC printer escape for Windows version 3.1.
Parameters
Return Value
Comments
hdc
See Also
Chapter 4, Functions
135
AbortProc
AbortProc
Syntax
3.1
BOOL CALLBACK AbortProc(hdc, error)
TAbortProc = function(OC: HOC; Error: Integer): Bool;
The AbortProc function is an application-defined callback function that is
called when a print job is to be canceled during spooling.
Parameters
Return Value
Comments
See Also
hdc
error
The callback function should return TRUE to continue the print job or
FALSE to cancel the print job.
An application installs this callback function by calling the SetAbortProc
function. AbortProc is a placeholder for the application-defined function
name. The actual name must be exported by including it in an EXPORTS
statement in the application's module-definition file.
GetMessage, PeekMessage, SetAbortProc
3.1
AllocDiskSpace
Syntax
#include <stress.h>
int AllocOiskSpace(lLeft, uOrive)
function AllocOiskSpace(1Left: Longint; wOrive: Word): Integer;
The AllocDiskSpace function creates a file that is large enough to ensure
that the specified amount of space or less is available on the specified disk
partition. The file, called STRESS. EAT, is created in the root directory of
the disk partition.
If STRESS.EAT already exists when AllocDiskSpace is called, the function
deletes it and creates a new one.
136
AllocFileHandles
Parameters
lLeft
uDrive
Meaning
EDS_WIN
EDS_CUR
EDS_TEMP
Return Value
The return value is greater than zero if the function is successful; it is zero
if the function could not create a file; or it is -1 if at least one of the
parameters is invalid.
Comments
In two situations, the amount of free space left on the disk may be less
than the number of bytes specified in the lLeft parameter: when the
amount of free space on the disk is less than the number in lLeft when an
application calls AllocDiskSpace, or when the value of lLeft is not an exact
multiple of the disk cluster size.
The UnAllocDiskSpace function deletes the file created by
AllocDiskSpace.
See Also
UnAllocDiskSpace
AllocFileHandles
Syntax
3.1
#include <stress.h>
int AllocFileHandles(Left)
function AllocFileHandles(left: Integer): Integer;
The AllocFileHandles function allocates file handles until only the
specified number of file handles is available to the current instance of the
application. If this or a smaller number of handles is available when an
application calls AllocFileHandles, the function returns immediately.
Before allocating new handles, this function frees any handles previously
allocates by AllocFileHandles.
Parameters
Chapter 4, Functions
Left
137
AllocGDIMem
Return Value
Comments
UnAllocFileHandles
AllocGDIMem
Syntax
3.1
#inc1ude <stress.h>
BaaL AllocGDIMem(uLeft)
function AllocGDIMem(wLeft: Word): Bool;
The AllocGDIMem function allocates memory in the graphics device
interface (GDI) heap until only the specified number of bytes is available.
Before making any new memory allocations, this function frees memory
previously allocated by AllocGDIMem.
Parameters
Return Value
Comments
See Also
138
uLeft
AliocUserMem
AllocMem
Syntax
3.1
#include <stress.h>
BOOL AllocMem(dwLeft)
function AllocMem(dwLeft: Longint): Bool;
The AllocMem function allocates global memory until only the specified
number of bytes is available in the global heap. Before making any new
memory allocations, this function frees memory previously allocated by
AllocMem.
Parameters
Return Value
Comments
See Also
dwLeft
AllocUserMem
Syntax
3.1
#include <stress.h>
BOOL AllocUserMem(uContig)
function AllocUserMem( wContig: Word): Bool;
The AllocUserMem function allocates memory in the USER heap until
only the specified number of bytes is available. Before making any new
allocations, this function frees memory previously allocated by
AllocUserMem.
Parameters
Return Value
Comments
See Also
Chapter 4, Functions
uContig
139
CallNextHookEx
3.1
Call NextHookEx
Syntax
Parameters
Return Value
Comments
See Also
hHook
nCode
wParam
IParam
The return value specifies the result of the message processing and
depends on the value of the nCode parameter.
Calling the CaliNextHookEx function is optional. An application can call
this function either before or after completing any processing in its own
hook function. If an application does not call CaliNextHookEx, Windows
will not call the hook functions that were installed before the application's
hook function was installed.
SetWindowsHookEx, UnhookWindowsHookEx
CallWndProc
Syntax
3.1
LRESULT CALLBACK CallWndProc(code, wParam, IParam)
The CallWndProc function is a library-defined callback function that the
system calls whenever the Send Message function is called. The system
passes the message to the callback function before passing the message to
the destination window procedure.
Parameters
140
code
CBTProc
Return Value
Comments
wParam
IParam
Description
IParam
wParam
uMsg
hWnd
See Also
CBTProc
Syntax
3.1
LRESULT CALLBACK CBTProc(code, wParam, IParam)
The CBTProc function is a library-defined callback function that the
system calls before activating, creating, destroying, minimizing,
maximizing, moving, or sizing a window; before completing a system
command; before removing a mouse or keyboard event from the system
message queue; before setting the input focus; or before synchronizing
with the system message queue.
Chapter 4, Functions
141
CBTProc
code
Code
Meaning
HCBT_ACTIVATE
HCBT_CLICKSKIPPED
HCBT_CREATEWND
HCBT_DESTROYWND
HCBT_KEYSKIPPED
HCBT_MOVESIZE
142
CBTProc
Code
Meaning
HCBT_QS
HCBT_SETFOCUS
HCBT_SYSCOMMAND
wParam
IParam
Return Value
Comments
The callback function should not install a playback hook except in the
situations described in the preceding list of hook codes.
This callback function must be in a dynamic-link library.
An application must install the callback function by specifying the
WH_CBT filter type and the procedure-instance address of the callback
function in a call to the SetWindowsHookEx function.
CBTProc is a placeholder for the library-defined function name. The
actual name must be exported by including it in an EXPORTS statement
Chapter 4, Functions
143
CBTProc
The following table describes the wParam and IParam parameters for each
HCBr_ constant.
Constant
wParam
HCBT_ACTIVATE
HCBT_CLICKSKIPPED
HCBT_CREATEWND
HCBT_DESTROYWND
HCBT_KEYSKIPPED
HCBT_MOVE SIZE
HCBT_QS
HCBT_SETFOCUS
144
IParam
ChooseColor
Constant
wParam
IParam
HCBT_SYSCOMMAND
Specifies a system-command
value (SC_) that specifies the
system command. For more
information about system
command values, see the
description of the
WM_SYSCOMMAND message.
See Also
CaliNextHookEx, SetWindowsHookEx
3. 1
ChooseColor
Syntax
#include <commdlg.h>
BOOL ChooseColor(lpcc)
function ChooseColor(var CC: TChooseColor): Bool;
The ChooseColor function creates a system-defined dialog box from
which the user can select a color.
Parameters
[pee
Chapter 4, Functions
/* cc * /
145
ChooseColor
Return Value
Errors
Comments
The dialog box does not support color palettes. The color choices offered
by the dialog box are limited to the system colors and dithered versions of
those colors.
If the hook function (to which the IpfnHook member of the
CHOOSECOLOR structure points) processes the WM_CTLCOLOR
message, this function must return a handle for the brush that should be
used to paint the control background.
Example
146
ChooseFont
memset(&cc, 0, sizeof(CHOOSECOLOR));
/* Initialize the necessary CHOOSE COLOR members. */
cc.1StructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = hwnd;
cc.rgbResult = clr;
cc.lpCustColors = aclrCust;
cc.Flags = CC_PREVENTFULLOPEN;
i~ChooseColor(&cc))
ChooseFont
Syntax
3. 1
#include <commdlg.h>
BOOL ChooseFont(lpcf)
function ChooseFont(var ChooseFont: TChooseFont): Bool;
The ChooseFont function creates a system-defined dialog box from
which the user can select a font, a font style (such as bold or italic), a point
size, an effect (such as strikeout or underline), and a color.
Parameters
[pct
Chapter 4, Functions
147
ClassFirst
Return Value
Errors
Example
ClassFirst
Syntax
3. 1
#include <toolhelp.h>
BOOL ClassFirst(lpce)
function ClassFirst(lpClass: PClassEntry): Bool;
The ClassFirst function fills the specified structure with general
information about the first class in the Windows class list.
148
ClassNext
Parameters
lpee
Return Value
Comments
See Also
3, 1
ClassNext
Syntax
#include <toolhelp.h>
BOOL ClassNext(lpce)
function ClassNext(lpClass: PClassEntry): Bool;
The ClassNext function fills the specified structure with general
information about the next class in the Windows class list.
Chapter 4, Functions
149
CloseDriver
Parameters
lpce
Return Value
Comments
See Also
ClassFirst
CloseDriver
Syntax
3.1
LRESULT CloseDriver(hdrvr, IParaml, IParam2)
function CloseDriver(Driver: THandle; IParaml, IParam2: Longint):
Longint;
The CloseDriver function closes an installable driver.
Parameters
Return Value
150
hdrvr
IParaml
IParam2
CommDlgExtendedError
Comments
See Also
CommDlgExtendedError
3.1
#include <commdlg.h>
DWORD CommDlgExtendedError(void)
Syntax
Choose Font
FindText
tI
GetFileTitie
a GetOpenFileName
ril
GetSaveFileName
a PrintDlg
Il
Parameters
Return Value
Chapter 4, Functions
ReplaceText
151
CommDlgExtendedError
Comments
Meaning
CDERR_FINDRESFAILURE
CDERR_INITIALIZATION
CDERR_LOADRESFAILURE
CDERR_LOCKRESFAILURE
CDERR_LOADSTRFAILURE
CDERR_MEMALLOCFAILURE
CDERR_MEMLOCKFAILURE
CDERR_NOHINSTANCE
CDERR_NOTEMPLATE
CDERR_REGISTERMSGFAIL
CDERR_STRUCTSIZE
CFERR_NOFONTS
CFERR_MAXLESSTHANMIN
152
CommDlgExtendedError
Value
Meaning
FNERR_BUFFERTOOSMALL
FNERR_INVALIDFILENAME
FNERR_SUBCLASSFAILURE
FRERR_BUFFERLENGTHZERO
PDERR_CREATEICFAILURE
PDERR_DEFAULTDIFFERENT
PDERR_DNDMMISMATCH
PDERR_GETDEVMODEFAIL
PDERR_INITFAILURE
PDERR_LOADDRVFAILURE
PDERR_NODEFAULTPRN
PDERR_NODEVICES
Chapter 4, Functions
153
CopyCursor
Value
Meaning
PDERR_PARSEFAILURE
PDERR_PRINTERNOTFOUND
PDERR_RETDEFFAILURE
PDERR_SETUPFAILURE
See Also
3. 1
CopyCursor
Syntax
Parameters
Return Value
Comments
hinst
hcur
The return value is the handle of the duplicate cursor if the function is
successful. Otherwise, it is NULL.
When it no longer requires a cursor, an application must destroy the
cursor, using the DestroyCursor function.
The CopyCursor function allows an application or dynamic-link library to
accept a cursor from another module. Because all resources are owned by
the module in which they originate, a resource cannot be shared after the
module is freed. CopyCursor allows an application to create a copy that
the application then owns.
See Also
154
CopyLZFile
Copylcon
Syntax
3. 1
HICON Copy Icon(hinst, hicon)
function CopyIcon(hInst: THandle; Icon: HIcon): HIcon;
The Copylcon function copies an icon.
Parameters
Return Value
Comments
hinst
hicon
Identifies the instance of the module that will copy the icon.
Identifies the icon to be copied.
The return value is the handle of the duplicate icon if the function is
successful. Otherwise, it is NULL.
When it no longer requires an icon, an application should destroy the
icon, using the Destroylcon function.
The Copylcon function allows an application or dynamic-link library to
accept an icon from another module. Because all resources are owned by
the module in which they originate, a resource cannot be shared after the
module is freed. Copy Icon allows an application to create a copy that the
application then owns.
See Also
CopyLZFile
Syntax
3.1
#inc1ude <lzexpand.h>
LONG CopyLZFile(hfSource, hfDest)
function CopyLZFile(Source, Dest: Integer): Longint;
The CopyLZFile function copies a source file to a destination file. If the
source file is compressed, this function creates a decompressed
destination file. If the source file is not compressed, this function
duplicates the original file.
Parameters
Return Value
Chapter 4, Functions
hfSource
hfDest
The return value specifies the size, in bytes, of the destination file if the
function is successful. Otherwise, it is an error value less than zero; it may
be one of the following:
155
CopyLZFile
Value
Meaning
LZERROR_BADINHANDLE
LZERROR_BADOUTHANDLE
LZERROR_READ
LZERROR_WRITE
LZERROR_GLOBALLOC
LZERROR_UNKNOWNALG
Comments
Example
char *szSrc[NUM_FILES]
{"readme. txt", "data. txt", "update. txt", "list. txt"};
char*szDest[NUM_FILES]=
{"readme.bak", "data.bak", "update.bak", "list.bak"};
OFSTRUCT ofStrSrc;
OFSTRUCT ofStrDest;
HFILE hfSrcFile, hfDstFile;
int i;
/* Allocate internal buffers for the CopyLZFile function. */
LZStart();
/* Open, copy, and then close the files. * /
for (i = 0; i < NUM FILES; i++) {
hfSrcFile = LZopenFile(szSrc[i], &ofStrSrc, OF READ);
hfDstFile = LZOpenFile(szDest[i], &ofStrDest, OF_CREATE);
156
CreateScalableFontResource
CopyLZFile(hfSrcFile, hfDstFile);
LZClose(hfSrcFile);
LZClose(hfDstFile);
LZDone () ; /* free the internal buffers * /
See Also
CPIAppiet
3.1
LONG CALLBACK* CPIApplet(hwndCPI, iMessage, IParaml, IParam2)
Syntax
Return Value
Comments
hwndCPl
iMessage
IParaml
IParam2
CreateScalableFontResource
Syntax
3.1
Chapter 4, Functions
157
CreateScalableFontResource
Parameters
[Hidden
Meaning
Return Value
Comments
IpszResourceFile
IpszFontFile
IpszCurrentPath
158
CreateScalableFontResource
string in IpszFontFile is copied into the .FOT file as the .TTF file that
belongs to this resource. When the AddFontResource function is called,
the system assumes that the .TTF file has been copied into the SYSTEM
directory (or into the main Windows directory in the case of a network
installation). The .TTF file need not be in this directory when the
CreateScalableFontResource function is called, because the
IpszCurrentPath parameter contains the directory information. A resource
created in this manner does not contain absolute path information and
can be used in any Windows installation.
When a path is specified in the IpszFontFile parameter and NULL is
specified in the IpszCurrentPath parameter, the string in IpszFontFile is
copied into the .FOT file. In this case, when the AddFontResource
function is called, the .TTF file must be at the location specified in the
IpszFontFile parameter when the CreateScalableFontResource function
was called; the IpszCurrentPath parameter is not needed. A resource
created in this manner contains absolute references to paths and drives
and will not work if the .TTF file is moved to a different location.
The CreateScalableFontResource function supports only TrueType
scalable fonts.
Example
The following example shows how to create a TrueType font file in the
SYSTEM directory of the Windows startup directory:
CreateScalableFontResource(O, "c:\\windows\\system\\font.fot",
"font.ttr", "c:\\windows\\system");
AddFontResource("c:\\windows\\system\\font.fot");
Chapter 4, Functions
159
DdeAbandonTransaction
CreateScalableFontResource
(O~\ font.
AddFontResource("font.fot");
hfont=CreateFont( ... ,CLIP_DEFAULT_PRECIS, ... ,"FONT");
. 1*
*1
DeleteObject(hfont)i
RemoveFontResource("font.fot")i
1*
*1
AddFontResource("font.for")i
hfont=CreateFont ( ... , CLIP_EMBEDDED, ... , "FONT");
. 1*
*1
DeleteObject(hfont)i
RemoveFontResource("font.for")i
1*
See Also
*1
AddFontResource
DdeAbandonTransaction
Syntax
160
3.1
#inc1ude <ddeml.h>
BOOL DdeAbandonTransaction(idInst, hConv, idTransaction)
DdeAbandonTransaction
Return Value
Errors
idlnst
hConv
idTransaction
Comments
Only a dynamic data exchange (DDE) client application should call the
DdeAbandonTransaction function. If the server application responds to
the transaction after the client has called DdeAbandonTransaction, the
system discards the transaction results. This function has no effect on
synchronous transactions.
See Also
Chapter 4, Functions
161
OdeAccessOoto
3.1
DdeAccessData
Syntax
#include <ddeml.h>
BYfE FAR* DdeAccessData(hData, IpcbData)
function DdeAccessData(Data: HDDEData; DataSize: PLongint): Pointer;
The DdeAccessData function provides access to the data in the given
global memory object. An application must call the DdeUnaccessData
function when it is finished accessing the data in the object.
Parameters
Return Value
Errors
hData
lpcbData
The return value points to the first byte of data in the global memory
object if the function is successful. Otherwise, the return value is NULL.
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALIDPARAMETER
DMLERR_NO_ERROR
Comments
If the hData parameter has not been passed to a Dynamic Data Exchange
Management Library (DDEML) function, an application can use the
pointer returned by DdeAccessData for read-write access to the global
memory object. If hData has already been passed to a DDEML function,
the pointer can only be used for read-only access to the memory object.
Example
162
DdeAddData
See Also
DdeAddData
Syntax
3.1
#include <ddeml.h>
HDDEDATA DdeAddData(hData, IpvSrcBuf, cbAddData, offObj)
function DdeAddData(Data: HDDEData; Src: Pointer; cb, Off: Longint):
HDDEData;
The DdeAddData function adds data to the given global memory object.
An application can add data beginning at any offset from the beginning of
the object. If new data overlaps data already in the object, the new data
overwrites the old data in the bytes where the overlap occurs. The
contents of locations in the object that have not been written to are
undefined.
Parameters
hData
IpvSrcBuf
cbAddData
offObj
Return Value
The return value is a new handle of the global memory object if the
function is successful. The new handle should be used in all references to
the object. The return value is zero if an error occurs.
Errors
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALIDPARAMETER
DMLERR_MEMORY_ERROR
DMLERR_NO_ERROR
Chapter 4, Functions
163
DdeAddData
Comments
1*
1*
1*
1*
1*
1*
1*
1*
instance identifier
data handle
item-name string handle
offset in global object
temporary string buffer
conversation handle
transaction results
TRUE if strings to add
*1
*1
*1
*1
*1
*1
*1
*1
1*
* If a string is available, the application-defined function
* IsThereAString () copies it to szMyBuf and returns TRUE. Otherwise,
* it returns FALSE.
*1
while((fAddAString=IsThereAString())) {
1*
1*
1*
1*
data handle
string buffer
character count
offset in object
*1
*1
*1
*1
See Also
164
OdeCallback
DdeCallback
Syntax
3.1
#include <ddeml.h>
HDDEDAT A CALLBACK DdeCallback(type, fmt, hconv, hszl, hsz2,
hData, dwDatal, dwData2)
TCallback = function(CallType, Fmt: Word; Conv: HConv; hszl, hsz2:
HSZ; Data: HDDEData; Datal, Data2: Longint): HDDEData;
The OdeCaliback function is an application-defined dynamic data
exchange (DDE) callback function that processes DDE transactions sent to
the function as a result of DDE Management Library (DDEML) calls by
other applications.
Parameters
type
Value
Chapter 4, Functions
165
OdeCaliback
Return Value
Comments
Value
Meaning
XC LASS_NOTIFICATION
fmt
hconv
hszl
hsz2
hData
dwDatal
dwData2
See Also
166
DdeEnableCaliback, Ddelnitialize
DdeClientTransaction
3.1
DdeClientTransaction
Syntax
#include <ddeml.h>
HDDEDATA DdeClientTransaction(lpvData, cbData, hConv, hszltem,
uFmt, uType, uTimeout, IpuResult)
function DdeClientTransaction(Data: Pointer; DataLen: Longint; Conv:
HConv; Item: HSZ; Fmt, DataType: Word; Timeout: Longint; Result:
PLongint): HDDEData;
The DdeClientTransaction function begins a data transaction between a
client and a server. Only a dynamic data exchange (DDE) client
application can call this function, and only after establishing a
conversation with the server.
Parameters
IpvData
cbData
hConv
hszltem
uFmt
uType
Chapter 4, Functions
167
DdeClientTransaction
Value
Meaning
XTYP_ADVSTART
Meaning
XTYPF_NODATA
XTYP _ADVSTOP
XTYP_EXECUTE
XTYP_POKE
XTYP_REQUEST
168
uTimeout
IpuResult
DdeClientTransaction
Errors
The return value is a data handle that identifies the data for successful
synchronous transactions in which the client expects data from the server.
The return value is TRUE for successful asynchronous transactions and
for synchronous transactions in which the client does not expect data. The
return value is FALSE for all unsuccessful transactions.
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_ADVACKTIMEOUT
DMLERR_BUSY
DMLERR_DATAACKTIMEOUT
DMLERR_DLL_NOT_INITIALIZED
DMLERR_EXECACKTIMEOUT
DMLERR_INVALIDPARAMETER
DMLERR_MEMORY_ERROR
DMLERR_NO_CONV_ESTABLISHED
DMLERR_NO_ERROR
DMLERR_NOTPROCESSED
DMLERR_POKEACKTIMEOUT
DMLERR_POSTMSG_FAILED
DMLERR_REENTRANCY
DMLERR_SERVER_DIED
DMLERR_UNADVACKTIMEOUT
Comments
When the application is finished using the data handle returned by the
DdeClientTransaction function, the application should free the handle by
calling the DdeFreeDataHandle function.
Transactions can be synchronous or asynchronous. During a synchronous
transaction, the DdeClientTransaction function does not return until the
transaction completes successfully or fails. Synchronous transactions
cause the client to enter a modal loop while waiting for various
asynchronous events. Because of this, the client application can still
respond to user input while waiting on a synchronous transaction but
cannot begin a second synchronous transaction because of the activity
associated with the first. The DdeClientTransaction function fails if any
instance of the same task has a synchronous transaction already in
progress.
Chapter 4, Functions
169
DdeCmpStringHandles
(LPBYTE) NULL,
0,
hconv,
hszNow,
CF_TEXT,
XTYF ADVSTART,
1000~
&dwResult)i
See Also
*/
*/
*/
*/
*/
*/
*/
*/
3.1
DdeCmpStringHandles
Syntax
#include <ddeml.h>
int DdeCmpStringHandles(hszl, hsz2)
function DdeCmpStringHandles(hszl, hsz2: HSZ): Integer;
The DdeCmpStringHandles function compares the values of two string
handles. The value of a string handle is not related to the case of the
associated string.
Parameters
170
hszl
hsz2
DdeCmpStringHandles
Return Value
Value
Meaning
-1
o
1
Comments
Example
/*
/*
/*
/*
service name */
topic name
*/
unknown server
conversation handle
/* result flags
/* instance identifier
*/
*/
*/
*/
/*
See Also
Chapter 4, Functions
171
DdeConnect
DdeConnect
Syntax
3.1
#include <ddeml.h>
HCONV DdeConnect(idInst, hszService, hszTopic, pCC)
function DdeConnect(lnst: Longint; Service, Topic: HSZ; CC:
PConvContext): HConv;
The DdeConnect function establishes a conversation with a server
application that supports the specified service name and topic name pair.
If more than one such server exists, the system selects only one.
Parameters
idlnst
hszService
hszTopic
pee
172
DdeConnect
Return Value
Errors
Comments
Example
See Also
Chapter 4, Functions
*/
*/
*/
*/
173
DdeConnectList
DdeConnectList
Syntax
3.1
#inc1ude <ddeml.h>
HCONVLIST DdeConnectList(idInst, hszService, hszTopic, hConvList,
pCC)
function DdeConnectList(Inst: Longint; Service, Topic: HSZ; convList:
HConvList; CC: PConvContext): HConvList;
The DdeConnectList function establishes a conversation with all server
applications that support the specified service/topic name pair. An
application can also use this function to enumerate a list of conversation
handles by passing the function an existing conversation handle. During
enumeration, the Dynamic Data Exchange Management Library
(DDEML) removes the handles of any terminated conversations from the
conversation list. The resulting conversation list contains the handles of
all conversations currently established that support the specified service
name and topic name.
Parameters
174
idlnst
hszService
hszTopic
hConvList
pCC
DdeConnectList
Return Value
The return value is the handle of a new conversation list if the function is
successful. Otherwise, it is NULL. The handle of the old conversation list
is no longer valid.
Errors
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALID_PARAMETER
DMLERR_NO_CONV_ESTABLISHED
DMLERR_NO_ERROR
DMLERR_SYS_ERROR
Comments
Example
Chapter 4, Functions
/*
/*
/*
/*
/*
/*
/*
conversation list
instance identifier
System topic
conversation handle
holds conversation data
count of conv. handles
point to string handles
*/
*/
*/
*/
*/
*/
*/
175
DdeCreateDataHandle
DdeDisconnectList(hconvList);
See Also
3.1
DdeCreateDataHandle
Syntax
#include <ddeml.h>
HDDEDATA DdeCreateDataHandle(idInst, IpvSrcBuf, cbInitData,
offSrcBuf, hszItem, uFmt, afCmd)
function DdeCreateDataHandleOnst: Longint; Src: Pointer; cb, Off:
Longint; Item: HSZ; Fmt, Cmd: Word): HDDEData;
The DdeCreateDataHandle function creates a global memory object and
fills the object with the data pointed to by the IpvSrcBuf parameter. A
dynamic data exchange (DOE) application uses this function during
transactions that involve passing data to the partner application.
176
DdeCreateDataHandle
Parameters
idlnst
IpvSrcBuf
cblnitData
offSrcBuf
hszltem
uFmt
afCmd
Return Value
Errors
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALIDPARAMETER
DMLERR_MEMORY_ERROR
DMLERR_NO_ERROR
Chapter 4, Functions
177
DdeCreateDataHandle
Comments
Any locations in the global memory object that are not filled are
undefined.
After a data handle has been used as a parameter in another DDEML
function or has been returned by a DOE callback function, the handle may
be used only for read access to the global memory object identified by the
handle.
If the application will be adding data to the global memory object (using
the DdeAddData function) so that the object exceeds 64K in length, then
the application should specify a total length (cblnitData + offSrcData) that
is equal to the anticipated maximum length of the object. This avoids
unnecessary data copying and memory reallocation by the system.
Example
/*
*/
= 0;
/*
* HSZPAIR structures.
*/
178
DdeCreateStringHandle
return DdeCreateDataHandle(
idlnst,
/* instance identifier
&ahp,
/* points to HSZPAIR array
sizeof(HSZ) * j, /* length of the array
0,
/ * start at the beginning
NULL,
/* no item-name string
fmt,
/* return the same format
0);
/* let the system own it
See Also
*/
*/
*/
*/
*/
*/
*/
3.1
DdeCreateStringHandle
Syntax
#include <ddeml.h>
HSZ OdeCreateStringHandle(idlnst, IpszString, codepage)
function OdeCreateStringHandleCInst: Longint; psz: PChar; CodePage:
Integer): HSZ;
The DdeCreateStringHandle function creates a handle that identifies the
string pointed to by the IpszString parameter. A dynamic data exchange
(DOE) client or server application can pass the string handle as a
parameter to other DOE Management Library functions.
Parameters
Return Value
Errors
idlnst
IpszString
codepage
Chapter 4, Functions
179
DdeCreateStringHandle
Comments
Two identical strings always correspond to the same string handle. String
handles are unique across all tasks that use the DDEML. That is, when an
application creates a handle for a string and another application creates a
handle for an identical string, the string handles returned to both
applications are identical-regardless of case.
The value of a string handle is not related to the case of the string it
identifies.
When an application has either created a string handle or received one in
the callback function and has used the DdeKeepStringHandle function to
keep it, the application must free that string handle when it is no longer
needed.
An instance-specific string handle is not mappable from string handle to
string to string handle again. This is shown in the following example, in
which the DdeQueryString function creates a string from a string handle
and then DdeCreateStringHandle creates a string handle from that string,
but the two handles are not the same:
DWORD idInst;
DWORD cb;
HSZ hszInst, hszNew;
psz pszInst;
DdeQueryString(idInst, hszInst, pszInst, cb, CP WINANSI);
hszNew = DdeCreateStringHandle(idInst, pszInst,-CP_WINANSI);
/* hszNew != hszInst ! */
Example
/*
/*
/*
/*
instance identifier
server's service name
topic name
use default CONVCONTEXT
*/
*/
*/
*/
uError = DdeGetLastError(idInst);
180
DdeDisconnectList
See Also
DdeDisconnect
Syntax
3.1
#include <ddeml.h>
BOOL DdeDisconnect(hConv)
function DdeDisconnect(Conv: HConv): Bool;
The DdeDisconnect function terminates a conversation started by either
the DdeConnect or DdeConnectList function and invalidates the given
conversation handle.
Parameters
Return Value
Errors
hConv
Comments
See Also
DdeDisconnectList
Syntax
3.1
#include <ddeml.h>
BOOL DdeDisconnectList(hConvList)
function DdeDisconnectList(ConvList: HConvList): Bool;
The DdeDisconnectList function destroys the given conversation list and
terminates all conversations associated with the list.
Chapter 4, Functions
181
OdeEnableCaliback
Parameters
Return Value
Errors
hConvList
Comments
See Also
3.1
DdeEnableCaliback
Syntax
#include <ddeml.h>
BOOL DdeEnableCallback(idInst, hConv, uCmd)
function DdeEnableCallbackOnst: Longint; Conv: HConv; Cmd: Word):
Bool;
The DdeEnableCallback function enables or disables transactions for a
specific conversation or for all conversations that the calling application
currently has established.
After disabling transactions for a conversation, the system places the
transactions for that conversation in a transaction queue associated with
the application. The application should reenable the conversation as soon
as possible to avoid losing queued transactions.
Parameters
182
idlnst
hConv
uCmd
DdeFreeDataHandle
Return Value
Errors
Value
Meaning
EC_ENABLEALL
EC_ENABLEONE
EC_DISABLE
Comments
See Also
DdeFreeDataHandle
Syntax
3.1
#include <ddeml.h>
BaaL DdeFreeDataHandle(hData)
function DdeFreeDataHandle(Data: HDDEData): Bool;
The DdeFreeDataHandle function frees a global memory object and
deletes the data handle associated with the object.
Chapter 4, Funcffons
183
DdeFreeDataHandle
Parameters
Return Value
Errors
hData
Comments
Example
184
DdeFreeStringHandle
DdeFreeDataHandle(hDataHelp);
See Also
DdeAccessData, DdeCreateDataHandle
DdeFreeStringHandle
Syntax
3.1
#include <ddeml.h>
BOOL DdeFreeStringHandle(idInst, hsz)
function DdeFreeStringHandle(lnst: Longint; HSZ: HSZ): Bool;
The DdeFreeStringHandle function frees a string handle in the calling
application.
Parameters
Return Value
Comments
Chapter 4, Functions
idlnst
hsz
185
OdeGetOata
Example
See Also
DdeGetData
Syntax
3.1
#include <ddeml.h>
DWORD DdeGetData(hData, pDest, cbMax, offSrc)
function DdeGetData(Data: HDDEData; Dst: Pointer; Max, Off: Longint):
Longint;
The DdeGetData function copies data from the given global memory
object to the specified local buffer.
Parameters
Return Value
hData
pDest
cbMax
offSrc
If the pDest parameter points to a buffer, the return value is the size, in
bytes, of the memory object associated with the data handle or the size
specified in the cbMax parameter, whichever is lower.
186
OdeGetLostError
If the pDest parameter is NULL, the return value is the size, in bytes, of
the memory object associated with the data handle.
Errors
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALID_HDDEDATA
DMLERR_INVALIDPARAMETER
DMLERR_NO_ERROR
Example
The following example copies data from a global memory object to a local
buffer and then fills the TIME structure with data from the buffer:
HDDEDATA hData;
char szBuf[32];
typedef
int
int
int
} TIME;
struct {
hour;
minute;
second;
See Also
3.1
DdeGetLostError
Syntax
#include <ddeml.h>
UINT DdeGetLastError(idInst)
function DdeGetLastError(lnst: Longint): Word;
The DdeGetLastError function returns the most recent error value set by
the failure of a Dynamic Data Exchange Management Library (DDEML)
function and resets the error value to DMLERR_NO_ERROR.
Parameters
Return Value
Chapter 4, Functions
idlnst
The return value is the last error value. Following are the possible
DDEML error values:
187
OdeGetLastError
Value
Meaning
DMLERR_ADVACKTIMEOUT
DMLERR_DATAACKTIMEOUT
DMLERR_EXECACKTIMEOUT
DMLERR_INVALIDPARAMETER
188
OdeGetLostError
Value
Meaning
DMLERR_MEMORY_ERROR
DMLERR_NO_CONY_ESTABLISHED
DMLERR_NOTPROCESSED
DMLERR_POKEACKTIMEOUT
DMLERR_POSTMSG_FAILED
DMLERR_REENTRANCY
DMLERR_UNADVACKTIMEOUT
Example
Chapter 4, Functions
= hszClock;
189
Ddelnitialize
See Also
Ddelnitialize
Ddelnitialize
Syntax
3.1
#include <ddeml.h>
DINT DdeInitializeOpidInst, pfnCallback, afCmd, uRes)
function DdeInitialize(var Inst: Longint; Callback: TCallback; Cmd, Res:
Longint): Word;
The Ddelnitialize function registers an application with the Dynamic Data
Exchange Management Library (DDEML). An application must call this
function before calling any other DDEML function.
Parameters
Ipidlnst
pfnCallback
190
Odelnitialize
afCmd
Flag
Meaning
APPCLASS_MONITOR
APPCLASS_STANDARD
APPCMD_CLIENTONLY
APPCMD_FILTERINITS
Chapter 4, Functions
191
Odelnitialize
Flag
Meaning
192
Odelnitiolize
Flag
Meaning
CBF_SKIP_CONNECT_CONFIRMS
CBF_SKIP_DISCONNECTS
CBF_SKIP_REGISTRATIONS
CBF_SKIP_UNREGISTRATIONS
uRes
Return Value
Comments
An application that uses multiple instances of the DDEML must not pass
DDEML objects between instances.
A DDE monitoring application should not attempt to perform DDE
(establish conversations, issue transactions, and so on) within the context
of the same application instance.
A synchronous transaction will fail with a DMLERR_REENTRANCY
error if any instance of the same task has a synchronous transaction
already in progress.
A DDE monitoring application can combine one or more of the following
monitor flags with the APPCLASS_MONITOR flag to specify the types of
DDE activity to monitor:
Flag
Meaning
MF_CALLBACKS
MF_CONV
Chapter 4, Functions
193
DdeKeepSfringHandle
Flag
Meaning
MF_LlNKS
Example
See Also
DdeKeepStringHandle
Syntax
3.'
#include <ddeml.h>
BaaL DdeKeepStringHandle(idlnst, hsz)
function DdeKeepStringHandle(Inst: Longint; HSZ: HSZ): Bool;
The DdeKeepStringHandle function increments the usage count
(increases it by one) associated with the given handle. This function
makes it possible for an application to save a string handle that was
passed to the application's dynamic data exchange (DOE) callback
function. Otherwise, a string handle passed to the callback function is
deleted when the callback function returns.
Parameters
194
idlnst
hsz
DdeNameService
Return Value
Example
DdeKeepStringHandle(idInst, hszl);
DdeKeepStringHandle(idInst, hsz2);
hszServerBase = hszl;
hszServerInst = hsz2;
/* Finish processing the transaction. */
See Also
3.1
DdeNameService
Syntax
#include <ddeml.h>
HDDEDATA DdeNameService(idInst, hszl, hszRes, afCmd)
function DdeNameService(Inst: Longint; hszl, hsz2: HSZ; Cmd: Word):
HDDEData;
The DdeNameService function registers or unregisters the service names
that a dynamic data exchange (DDE) server supports. This function
causes the system to send XTYP _REGISTER or XTYP_UNREGISTER
transactions to other running DDE Management Library (DDEML) client
applications.
A server application should call this function to register each service
name that it supports and to unregister names that it previously
registered but no longer supports. A server should also call this function
to unregister its service names just before terminating.
Parameters
Chapter 4, Functions
idlnst
195
DdeNameService
hszl
Identifies the string that specifies the service name that the
server is registering or unregistering. An application that is
unregistering all of its service names should set this
parameter to NULL.
hszRes
afCmd
Value
Meaning
DNS_REGISTER
DNS_UNREGISTER
DNS_FILTERON
Return Value
Errors
Comments
196
The service name identified by the hszl parameter should be a base name
(that is, the name should contain no instance-specific information). The
system generates an instance-specific name and sends it along with the
base name during the XTYP _REGISTER and XTYP_UNREGISTER
transactions. The receiving applications can then connect to the specific
application instance.
DdePostAdvise
Example
See Also
3.1
DdePostAdvise
Syntax
#include <ddeml.h>
BOOL DdePostAdvise(idInst, hszTopic, hszItem)
function DdePostAdviseOnst: Longint; Topic, Item: HSZ): Bool;
The DdePostAdvise function causes the system to send an
XTYP_ADVREQ transaction to the calling (server) application's dynamic
data exchange (DOE) callback function for each client that has an advise
loop active on the specified topic or item name pair. A server application
should call this function whenever the data associated with the topic or
item name pair changes.
Parameters
Chapter 4, Functions
idlnst
hszTopic
197
DdePostAdvise
hszItem
Return Value
Errors
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_DLL_NOT_INITIALIZED
DMLERR_DLL_USAGE
DMLERR_NO_ERROR
Comments
A server that has nonenumerable topics or items should set the hszTopic
and hszItem parameters to NULL so that the system will generate transactions for all active advise loops. The server's DOE callback function
returns NULL for any advise loops that do not need to be updated.
If a server calls DdePostAdvise with a topic/item/format name set that
includes the set currently being handled in a XTYP _ADVREQ callback, a
stack overflow may result.
Example
See Also
198
Ddelnitialize
DdeQueryConvlnfo
3.1
DdeQueryConvlnfo
Syntax
#include <ddeml.h>
UINT DdeQueryConvInfo(hConv, idTransaction, lpConvInfo)
function DdeQueryConvInfo(Conv: HConv; Transaction: Longint;
ConvInfo: PConvInfo): Word;
The DdeQueryConvlnfo function retrieves information about a dynamic
data exchange (DOE) transaction and about the conversation in which the
transaction takes place.
Parameters
hConv
idTransaction
IpConvlnfo
Return Value
The return value is the number of bytes copied into the CONVINFO
structure, if the function is successful. Otherwise, it is zero.
Chapter 4, Functions
199
DdeQueryNextServer
Errors
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_DLL_NOT_INITIALIZED
DMLERR_NO_CONY_ESTABLISHED
DMLERR_NO_ERROR
DMLERR_UNFOUND_QUEUE_ID
Example
See Also
3.1
DdeQueryNextServer
Syntax
#include <ddeml.h>
HCONV DdeQueryNextServer(hConvList, hConvPrev)
function DdeQueryNextServer(ConvList: HConvList; ConvPrev: HConv):
HConv;
The DdeQueryNextServer function obtains the next conversation handle
in the given conversation list.
Parameters
200
hConvList
DdeQueryNextServer
hConvPrev
Return Value
Example
The return value is the next conversation handle in the list if the list
contains any more conversation handles. Otherwise, it is NULL.
The following example uses the DdeQueryNextServer function to count
the number of conversation handles in a conversation list and to copy the
service-name string handles of the servers to a local buffer:
HCONVLIST hconvList;
DWORD idInst;
HSZ hszSystem;
HCONV hconv = NULL;
CONVINFO Cii
UINT cConv = 0;
HSZ *pHsz, *aHsz;
/*
/*
/*
/*
/*
/*
/*
conversation list
instance identifier
System topic
conversation handle
holds conversation data
count of conv. handles
point to string handles
*/
*/
*/
*/
*/
*/
*/
See Also
Chapter 4, Functions
DdeConnectList, DdeDisconnectList
201
DdeQueryString
3.1
DdeQueryString
Syntax
#include <ddeml.h>
DWORD DdeQueryString(idInst, hsz, lpsz, cchMax, codepage)
function DdeQueryString(lnst: Longint; HSZ: HSZ; psz: PChar; Max:
Longint; CodePage: Integer): Longint;
The DdeQueryString function copies text associated with a string handle
into a buffer.
The string returned in the buffer is always null-terminated. If the string is
longer than (cchMax - 1), only the first (cchMax - 1) characters of the string
are copied.
If the Ipsz parameter is NULL, this function obtains the length, in bytes, of
the string associated with the string handle. The length does not include
the terminating null character.
Parameters
Return Value
202
idlnst
hsz
Ipsz
cchMax
codepage
The return value is the length, in bytes, of the returned text (not including
the terminating null character) if the Ipsz parameter specified a valid
pointer. The return value is the length of the text associated with the hsz
parameter (not including the terminating null character) if the Ipsz
parameter specified a NULL pointer. The return value is NULL if an error
occurs.
DdeReconnect
Example
See Also
DdeReconnect
Syntax
3.'
#include <ddeml.h>
HCONV DdeReconnect(hConv)
function DdeReconnect(Conv: HConv): HConv;
The DdeReconnect function allows a client Dynamic Data Exchange
Management Library (DDEML) application to attempt to reestablish a
conversation with a service that has terminated a conversation with the
client. When the conversation is reestablished, the DDEML attempts to
reestablish any preexisting advise loops.
Parameters
Return Value
Chapter 4, Functions
hConv
203
DdeSetUserHandle
Errors
Use the DdeGetLastError function to retrieve the error value, which may
be one of the following:
DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALIDPARAMETER
DMLERR_NO_CONY_ESTABLISHED
DMLERR_NO_ERROR
Example
BOOL fAutoReconnect;
switch (wType) {
case XTYF DISCONNECT:
if (fAutoReconnect)
DdeReconnect(hConv); /* attempt to reconnect */
return 0;
/* Process other transactions. */
See Also
DdeConnect, DdeDisconnect
3.1
DdeSetUserHandle
Syntax
#include <ddeml.h>
BOOL DdeSetUserHandle(hConv, id, hUser)
function DdeSetUserHandle(Conv: HConv; ID, User: Longint): Bool;
The DdeSetUserHandle function associates an application-defined 32-bit
value with a conversation handle and transaction identifier. This is useful
for simplifying the processing of asynchronous transactions. An
application can use the DdeQueryConvlnfo function to retrieve this value.
204
DdeUnaccessData
Parameters
Return Value
Errors
hConv
id
hUser
See Also
DdeQueryConvlnfo
DdeUnaccessData
Syntax
3.1
#inc1ude <ddeml.h>
BOOL DdeUnaccessData(hData)
function DdeUnaccessData(Data: HDDEData): Bool;
The DdeUnaccessData function frees a global memory object. An
application must call this function when it is finished accessing the object.
Parameters
Return Value
Errors
hData
Chapter 4, Functions
205
OdeUninitiolize
Example
See Also
DdeUninitialize
Syntax
3.1
#inc1ude <ddeml.h>
BOOL DdeUninitialize(idInst)
function DdeUninitialize(lnst: Longint): Bool;
The DdeUninitialize function frees all Dynamic Data Exchange
Management Library (DDEML) resources associated with the calling
application.
Parameters
idlnst
Return Value
Comments
See Also
206
DebugOutput
3.1
DebugOutput
Syntax
Parameters
flags
DBF_WARNING
IpszFmt
Meaning
Return Value
Comments
Chapter 4, Functions
207
DebugProc
See Also
DebugProc
Syntax
3.1
LRESUL T CALLBACK DebugProc(code, wParam, IParam)
The DebugProc function is a library-defined callback function that the
system calls before calling any other filter installed by the
SetWindowsHookEx function. The system passes information about the
filter about to be called to the DebugProc callback function. The callback
function can examine the information and determine whether to allow the
filter to be called.
Parameters
code
wParam
Specifies the task handle of the task that installed the filter
about to be called.
IParam
208
DefDriverProc
Return Value
Comments
The callback function should return TRUE to prevent the system from
calling another filter. Otherwise, the callback function must pass the filter
information to the CaliNextHookEx function.
An application must install this callback function by specifying the
WH_DEBUG filter type and the procedure-instance address of the
callback function in a call to the SetWindowsHookEx function.
CallWndProc is a placeholder for the library-defined function name. The
actual name must be exported by including it in an EXPORTS statement
in the library's module-definition file.
See Also
CaliNextHookEx, SetWindowsHookEx
3. 1
DefDriverProc
Syntax
Parameters
dwDriverldentifier
hdrvr
uMsg
IParaml
IParam2
Return Value
Comments
See Also
Chapter 4, Functions
209
DirectedYield
DirectedYield
Syntax
3.1
void DirectedYield(htask)
procedure DirectedYield(Task: TTask);
The DirectedYield function puts the current task to sleep and awakens the
given task.
Parameters
Return Value
Comments
htask
See Also
210
DlgDirSelecfComboBoxEx
DlgDirSelectComboBoxEx
Syntax
3.0
Parameters
Return Value
Comments
hwndDlg
IpszPath
cbPath
idComboBox
See Also
Chapter 4, Functions
211
DlgDirSelectEx
2.x
DlgDirSelectEx
Syntax
Parameters
Return Value
Comments
hwndDlg
IpszPath
cbPath
idListBox
The return value is nonzero if the current list box selection is a directory
name. Otherwise, it is zero.
If the current selection is a directory name or drive letter, DlgDirSelectEx
removes the enclosing square brackets (and hyphens, for drive letters) so
that the name or letter is ready to be inserted into a new path or filename.
If there is no selection, the contents of buffer pointed to by the IpszPath
parameter do not change.
The DlgDirSelectEx function does not allow more than one filename to be
returned from a list box.
The list box must not be a multiple-selection list box. If it is, this function
will not return a zero value and IpszPath will remain unchanged.
DlgDirSelectEx sends LB_GETCURSEL and LB_GETTEXT messages to
212
DragFinish
3.1
DragAcceptFiles
Syntax
#include <shellapi.h>
void DragAcceptFiles(hwnd, fAccept)
procedure DragAcceptFiles(Wnd: HWnd; Accept: Bool);
The DragAcceptFiles function registers whether a given window accepts
dropped files.
hwnd
fAccept
Parameters
Return Value
Comments
DragFinish
Syntax
3.1
#include <shellapi.h>
void DragFinish(hDrop)
procedure DragFinish(Drop: THandle);
The DragFinish function releases memory that Windows allocated for use
in transferring filenames to the application.
Parameters
Return Value
Chapter 4, Functions
hDrop
213
DragQueryFile
DragQueryFile
Syntax
3.1
#inc1ude <shellapLh>
UINT DragQueryFile(hDrop, iFile, IpszFile, cb)
function DragQueryFile(Drop: THandle; FileIndex: Word; FileName:
PChar; cb: Word): Word;
The DragQueryFile function retrieves the number of dropped files and
their filenames.
Parameters
Return Value
See Also
hDrop
iFile
IpszFile
cb
When the function copies a filename to the IpszFile buffer, the return value
is the number of bytes copied. If the iFile parameter is OxFFFF, the return
value is the number of dropped files. If iFile is between zero and the total
number of dropped files and if IpszFile is NULL, the return value is the
required size of the IpszFile buffer.
DragQueryPoint
DragQueryPoint
Syntax
214
3.1
#inc1ude <shellapi.h>
BaaL DragQueryPoint(hDrop, lppt)
DriverProc
hDrop
lppt
/* pt */
int x;
int y;
} POINT;
Return Value
Comments
See Also
The return value is nonzero if the file is dropped in the client area of the
window. Otherwise, it is zero.
The DragQueryPoint function fills the POINT structure with the
coordinates of the position at which the cursor was located when the user
released the left mouse button. The window for which coordinates are
returned is the window that received the WM_DROPFILES message.
DragQueryFile
DriverProc
Syntax
3. 1
LRESULT CALLBACK DriverProc(dwDriverIdentifier, hDriver,
wMessage, IParaml, IParam2)
The DriverProc function processes the specified message.
Parameters
Chapter 4, Functions
dwDriverldentifier
hDriver
wMessage
215
DriverProc
Message
Description
DRV_CONFIGURE
DRV_DISABLE
DRV_FREE
DRV_INSTALL
DRV_OPEN
DRV_POWER
DRV_QUERYCONFIGURE
DRV_REMOVE
IParaml
IParam2
Return Value
Comments
See Also
216
EnableCommNotification
3.1
EnableCommNotification
Syntax
Parameters
Chapter 4, Functions
idComDev
hwnd
cb WriteNotify
217
EnableScroliBar
cbOutQueue
Return Value
Comments
The Windows 3.0 version of COMM.DRV does not support this function.
EnableScroliBar
Syntax
3.1
Parameters
218
hwnd
fnSBFlags
EnableScrollBar
fuArrowFlags
Value
Meaning
SB_BOTH
Meaning
ESB_ENABLE_BOTH
ESB_DISABLE_LTUP
ESB_DISABLE_BOTH
Return Value
Example
See Also
Chapter 4, Functions
ShowScrollBar
219
EndDoc
EndDoc
3.1
Syntax
int EndOoc(hdc)
function EndOoc(OC: HOC): Integer;
The End Doc function ends a print job. This function replaces the
END DOC printer escape for Windows version 3.1.
Parameters
Return Value
Comments
hdc
See Also
EndPage
Syntax
3.1
int EndPage(hdc)
function EndPage(OC: HOC): Integer;
The EndPage function signals the device that the application has finished
writing to a page. This function is typically used to direct the driver to
advance to a new page.
This function replaces the NEWFRAME printer escape for Windows 3.1.
Unlike NEWFRAME, this function is always called after printing a page.
Parameters
Return Value
Errors
220
hdc
EnumFontFamilies
Value
Meaning
SP_ERROR
SP_APPABORT
General error.
Job was terminated because the application's printcanceling function returned zero.
User terminated the job by using Windows Print
Manager (PRINTMAN .EXE).
Not enough disk space is currently available for
spooling, and no more space will become available.
Not enough memory is available for spooling.
SP_USERABORT
SP_OUTOFDISK
SP_OUTOFMEMORY
Comments
See Also
3.1
EnumFontFamilies
Syntax
Parameters
hdc
IpszFamily
fntenmprc
IParam
Return Value
Chapter 4, Functions
The return value specifies the last value returned by the callback function,
if the function is successful. This value depends on which font families are
available for the given device.
221
EnumFontFamProc
Comments
Example
See Also
EnumFonts, EnumFontFamProc
EnumFontFamProc
Syntax
3.1
Parameters
222
Ipnlf
EnumFontFamProc
struct tagNEWLOGFONT
/* nlf */
int
lfHeight;
int
lfWidth;
int
lfEscapement;
int
lfOrientation;
int
lfWeighti
BYTE lfltalic;
BYTE lfUnderline;
BYTE lfStrikeOuti
BYTE lfCharSeti
BYTE lfOutPrecisioni
BYTE lfClipPrecision;
BYTE lfQualitYi
BYTE lfPitchAndFamilYi
BYTE lfFaceName[LF_FACESIZE]i
BYTE lfFullName [2 * LF_FACESIZE]; /* TrueType only
*/
BYTE
lfStyle[LF_FACESIZE];
/* TrueType only
*/
}NEWLOGFONT i
Chapter 4, Functions
223
EnumFontFamProc
/* ntm */
FontType
IParam
Return Value
Comments
224
EnumFontsProc
EnumFontFamilies, EnumFonts
3.1
EnumFontsProc
Syntax
Parameters
Iplf
Chapter 4, Functions
225
EnumFontsProc
Ipntm
/* ntm */
FontType
IpData
Return Value
226
EnumMetaFileProc
Comments
See Also
EnumFonts, EnumFontFamilies
EnumMetaFileProc
3.1
Syntax
Return Value
hdc
Ipht
Ipmr
cObj
IParam
Comments
Chapter 4, Functions
227
EnumObjectsProc
EnumMetaFile
EnumObjectsProc
Syntax
3.1
Parameters
IpLogObject
/* 19pn */
IpData
Return Value
Comments
228
/* lb */
EnumObjecfsProc
Example
/*
* The pbData parameter contains the number of horizontally
* hatched brushes; the lpDest parameter is set to follow the
* byte reserved for pbData and the LOGBRUSH structures that
* have been filled with brush information.
*/
LPLOGBRUSH lpDest =
(LPLOGBRUSH) (pbData + 1 + (*pbData * sizeof(LOGBRUSH)));
if (lpLogBrush->lbStyle ==
BS_HATCHED && /* if horiz hatch */
lpLogBrush->lbHatch == HS HORIZONTAL)
*lpDest++ = *lpLogBrush; /* fills structure with brush info */
(*pbData) ++;
/* increments brush count
*/
if (*pbData >= MAXBRUSHES)
return 0;
return 1;
See Also
Chapter 4, Functions
229
EnumPropFixedProc
EnumPropFixedProc
Syntax
2.x
Parameters
Return Value
Comments
hwnd
Ipsz
hData
230
EnumPropMovableProc
EnumPropMovableProc
Syntax
2.x
Parameters
Return Value
Comments
hwnd
Ipsz
hData
The callback function must not yield control or do anything that might
yield control to other tasks.
IJ
El
The EnumPropMovableProc function is a placeholder for the applicationdefined function name. The actual name must be exported by including it
in an EXPORTS statement in the application's module-definition (.DEF) file.
See Also
Chapter 4, Functions
231
EnumToskWndProc
2.x
EnumTaskWndProc
Syntax
Parameters
Return Value
Comments
hwnd
IParam
See Also
EnumTaskWindows
2.x
EnumWindowsProc
Syntax
Parameters
Return Value
Comments
232
hwnd
IParam
ExitWindowsExec
EnumWindows
3.0
ExitWindowsExec
Syntax
Parameters
Return Value
Comments
IpszExe
IpszParams
The return value is FALSE if the function fails. (The function could fail
because of a memory-allocation error or if one of the applications in the
system does not terminate.)
The ExitWindowsExec function is typically used by installation programs
to replace components of Windows which are active when Windows is
running.
See Also
Chapter 4, Functions
ExitWindows
233
Extractlcon
3. 1
Extractlcon
Syntax
#include <shellapi.h>
HICON ExtractIcon(hinst, IpszExeName, iIcon)
function Extractlcon(lnst: THandle; ExeFileName: PChar; IconIndex:
Word): HIcon;
The Extractlcon function retrieves the handle of an icon from a specified
executable file, dynamic-link library (DLL), or icon file.
Parameters
Return Value
hinst
lpszExeName
iIcon
3.1
FindExecutoble
Syntax
#include <shellapi.h>
HINSTANCE FindExecutableOpszFile, IpszDir, IpszResult)
function FindExecutable(FileName, Directory, Result: PChar): THandle;
The FindExecutable function finds and retrieves the executable filename
that is associated with a specified filename.
Parameters
234
lpszFile
lpszDir
lpszResult
FindExecutable
Errors
o
2
3
5
6
8
10
11
12
13
14
15
16
19
20
21
Comments
See Also
Chapter 4, Functions
Meaning
235
FindText
3.1
FindText
Syntax
#include <commdlg.h>
HWND FindTextOpfr)
function FindText<var FindReplace: TFindReplace): HWnd;
The FindText function creates a system-defined modeless dialog box that
makes it possible for the user to find text within a document. The
application must perform the search operation.
Parameters
[pfr
Return Value
Errors
The return value is the window handle of the dialog box if the function is
successful. Otherwise, it is NULL. An application can use this window
handle to communicate with or to close the dialog box.
Use the CommDlgExtendedError function to retrieve the error value,
which may be one of the following values:
CDERR_FINDRESFAILURE
CDERR_INITIALIZATION
CDERR_LOCKRESFAILURE
CDERR_LOADRESFAILURE
CDERR_LOADSTRFAILURE
236
FindText
CDERR_MEMALLOCFAILURE
CDERR_MEMLOCKFAILURE
CDERR_NOHINSTANCE
CDERR_NOHOOK
CDERR_NOTEMPLATE
CDERR_STRUCTSIZE
FRERR_BUFFERLENGTHZERO
Comments
The dialog box procedure for the Find dialog box passes user requests to
the application through special messages. The IParam parameter of each of
these messages contains a pointer to a FINDREPLACE structure. The
procedure sends the messages to the window identified by the
hwndOwner member of the FINDREPLACE structure. An application can
register the identifier for these messages by specifying the
"commdlg_FindReplace" string in a call to the RegisterWindowMessage
function.
For the TAB key to function correctly, any application that calls the
FindText function must also call the Is Dialog Message function in its main
message loop. (The IsDialogMessage function returns a value that
indicates whether messages are intended for the Find dialog box.)
If the hook function (to which the IpfnHook member of the
FINDREPLACE structure points) processes the WM_CTLCOLOR
message, this function must return a handle of the brush that should be
used to paint the control background.
Example
memset(&fr, 0, sizeof(FINDREPLACE));
fr.1StructSize = sizeof(FINDREPLACE);
fr.hwndOwner = hwnd;
fr.lpstrFindWhat = szFindWhat;
fr.wFindWhatLen = sizeof(szFindWhat);
hDlg = FindText(&fr);
break;
Chapter 4, Functions
237
FMExtensionProc
See Also
FMExtensionProc
Syntax
3.1
#include <wfext.h>
HMENU FAR PASCAL FMExtensionProc(hwnd, wMsg,IParam)
TFM_Ext_Proc = function(Handle: HWnd; w: Word; 1: Longint): Longint;
The FMExtensionProc function, an application-defined callback function,
processes menu commands and messages sent to a File Manager
extension dynamic-link library (DLL).
Parameters
238
hwnd
wMsg
FreeAIIGDIMem
Value
Meaning
1-99
FMEVENT_INITMENU
FMEVENT_LOAD
FMEVENT_SELCHANGE
FMEVENT_UNLOAD
FMEVENT_USER_REFRESH
IParam
Return Value
The callback function should return the result of the message processing.
The actual return value depends on the message that is processed.
Comments
FreeAIIGDIMem
Syntax
3.1
#include <stress.h>
void FreeAllGDIMem(void)
procedure FreeAllGDIMem;
The FreeAIIGDIMem function frees all memory allocated by the
AllocGDIMem function.
Parameters
Return Value
See Also
Chapter 4, Functions
239
FreeAIiMem
FreeAIiMem
Syntax
3.1
#inc1ude <stress.h>
void FreeAllMem(void)
procedure FreeAllMem;
The FreeAIiMem function frees all memory allocated by the AllocMem
function.
Parameters
Return Value
See Also
FreeAIiUserMem
Syntax
3.1
#inc1ude <stress.h>
void FreeAllUserMem(void)
procedure FreeAllUserMem;
The FreeAIiUserMem function frees all memory allocated by the
AliocUserMem function.
Parameters
Return Value
See Also
GetAspectRatioFilterEx
Syntax
3.1
240
GetBoundsRect
filter, the aspect-ratio filter, to select fonts designed for a particular aspect
ratio from all of the available fonts. The filter uses the aspect ratio
specified by the SetMapperFlags function.
Parameters
Return Value
See Also
hDC
IpAspectRatio
GetBitmapDimensionEx
Syntax
2.x
Parameters
hBitmap
IpDimension
Return Value
See Also
GetBoundsRect
Syntax
3.1
Chapter 4, Functions
241
GetBoundsRect
hdc
IprcBounds
flags
Meaning
DCB_WINDOWMGR
Return Value
Comments
See Also
242
The return value specifies the current state of the bounding rectangle if
the function is successful. It can be a combination of the following values:
Value
Meaning
DCB_ACCUMULATE
DCB_RESET
DCB_SET
DCB_ENABLE
DCB_DISABLE
GetCharABCWidths
GetBrushOrgEx
Syntax
3.1
Parameters
hDC
IpPoint
/* pt */
int Xi
int Yi
} POINT i
Return Value
Comments
See Also
GetCharABCWidths
Syntax
3.1
Parameters
Chapter 4, Functions
hdc
uFirstChar
uLastChar
243
GetClipCursor
lpabe
Return Value
Comments
See Also
EnumFontFamilies, GetCharWidth
GetClipCursor
Syntax
3.1
void GetClipCursor(lprc)
procedure GetClipCursor(var Rect: TRect);
The GetClipCursor function retrieves the screen coordinates of the
rectangle to which the cursor has been confined by a previous call to the
ClipCursor function.
Parameters
244
lpre
GetCursor
Return Value
See Also
/* rc */
3.1
GetCurrentPositionEx
Syntax
Parameters
Return Value
hdc
IpPoint
GetCursor
Syntax
3.1
HCURSOR GetCursor(void)
function GetCursor: HCursor;
The GetCursor function retrieves the handle of the current cursor.
Parameters
Return Value
See Also
Chapter 4, Functions
245
GetDCEx
GetDCEx
Syntax
3.1
HDC GetDCEx(hwnd, hrgnClip, fdwOptions)
function GetDCEx(Wnd: HWnd; Clip: HRgn; Flags: Longint): HDC;
The GetDCEx function retrieves the handle of a device context for the
given window. The device context can be used in subsequent graphics
device interface (GD!) functions to draw in the client area.
This function, which is an extension to the GetDC function, gives an
application more control over how and whether a device context for a
window is clipped.
Parameters
hwnd
hrgnClip
fdwOptions
Value
Meaning
DCX_CACHE
DCX_CLIPCHILDREN
DCX_CLIPSIBLINGS
DCX_EXCLUDERGN
DCX_INTERSECTRGN
DCX_LOCKWINDOWUPDATE
246
GetDriverlnfo
Return Value
Comments
Value
Meaning
DCX_PARENTCLIP
The return value is a handle of the device context for the specified
window, if the function is successful. Otherwise, it is NULL.
Unless the device context belongs to a window class, the ReleaseDC
function must be called to release the context after drawing. Since only
five common device contexts are available at any given time, failure to
release a device context can prevent other applications from accessing a
device context.
A device context belonging to the window's class is returned by the
GetDCEx function if the CS_CLASSDC, CS_OWNDC, or CS_PARENTDC
class style was specified in the WNDCLASS structure when the class was
registered.
In order to obtain a cached device context, an application must specify
DCX_CACHE. If DCX_CACHE is not specified and the window is neither
CS_OWNDC nor CS_CLASSDC, this function returns NULL.
See Also
GetDriverlnfo
Syntax
3.1
BOOL GetDriverInfo(hdrvr, Ipdis)
function GetDriverInfo(hDriver: THandle; lpdis: PDriverInfoStruct): Bool;
The GetDriverlnfo function retrieves information about an installable
driver.
Parameters
Chapter 4, Functions
hdrvr
247
GetDriverModuleHandle
[pdis
Return Value
/* drvinfst */
GetDriverModuleHandle
Syntax
3.1
HINSTANCE GetDriverModuleHandle(hdrvr)
function GetDriverModuleHandle(Driver: THandle): THan die;
The GetDriverModuleHandle function retrieves the instance handle of a
module that contains an install able driver.
Parameters
Return Value
See Also
248
hdror
The return value is an instance handle of the driver module if the function
is successful. Otherwise, it is NULL.
OpenDriver
GetExpandedName
3.1
GetExpandedName
Syntax
#include <lzexpand.h>
int GetExpandedName(lpszSource, IpszBuffer)
function GetExpandedName(Source, Buffer: PChar): Integer;
The GetExpandedName function retrieves the original name of a
compressed file if the file was compressed with the COMPRESS.EXE
utility and the Ir option was specified.
Parameters
IpszSource
IpszBuffer
Return Value
Example
* operation.
*/
hfCompFile = LZInit(hfSrcFile);
Chapter 4, Functions
249
GetFileResource
/ * Copy the
*/
do {
if ((cbRead = LZRead(hfCompFile, abBuf, sizeof(abBuf))) > 0)
_lwrite(hfDstFile, abBuf, cbRead);
else {
. /* handle error condition */
while (cbRead == sizeof(abBuf));
Comments
This function retrieves the original filename from the header of the
compressed file. If the source file is not compressed, the filename to which
IpszSource points is copied to the buffer to which IpszBuffer points.
If the Ir option was not set when the file was compressed, the string in the
3.1
GetFileResource
Syntax
#include <ver.h>
BOOL GetFileResourceOpszFileName, lpszResType, lpszResID,
dwFileOffset, dwResLen, lpvData)
function GetFileResource(FileName: PChar; ResType: PChar; ResID:
PChar; FileOffset: Longint; ResLen: Longint; Data: PChar): Bool;
The GetFileResource function copies the specified resource from the
specified file into the specified buffer. To obtain the appropriate buffer
size, the application can call the GetFileResourceSize function before
calling GetFileResource.
Parameters
250
IpszFileName
IpszResType
IpszResID
GetFileResourceSize
dwFileOffset
dwResLen
IpvData
truncated.
Return Value
Comments
GetFileResourceSize
GetFileResourceSize
Syntax
3.1
#include <ver.h>
DWORD GetFileResourceSize(lpszFileName, IpszResType, IpszResID,
IpdwFileOffset)
function GetFileResourceSize(FileName: PChar; ResType: PChar; ResID:
PChar; var FileOffset: Longint): Longint;
The GetFileResourceSize function searches the specified file for the
resource of the specified type and identifier.
Parameters
Chapter 4, Functions
IpszFileName
251
GetFileTitle
IpszResType
IpszResID
See Also
The return value is the size of the resource, in bytes. The return value is
NULL if the function could not find the file, the file does not have any
resources attached, or the function produced an MS-DOS error. The
GetFileResourceSize function returns no information about the type of
error that occurred.
GetFileResource
3. 1
GetFileTitle
Syntax
#include <commdlg.h>
int GetFileTitle(lpszFile, IpszTitle, cbBuO
function GetFileTitleCFileName, Title: PChar; TitleSize: Word): Integer;
The GetFileTitle function returns the title of the file identified by the
IpszFile parameter.
Parameters
252
IpszFile
IpszTitle
cbBuf
Return Value
The return value is zero if the function is successful. The return value is a
negative number if the filename is invalid. The return value is a positive
integer that specifies the required buffer size, in bytes, if the buffer to
which the IpszTitle parameter points is too small.
Comments
The function returns an error value if the buffer pointed to by the IpszFile
parameter contains any of the following:
13
An empty string
A string containing a wildcard (*), opening bracket (D, or closing
bracketeD
IJ
A string that ends with a colon (:), slash mark (/), or backslash (\)
IJ
3.1
GetFileVersionlnfo
Syntax
#include <ver.h>
BOOL GetFileVersionInfo(lpszFileName, handle, cbBuf,lpvData)
function GetFileVersionInfo(FileName: PChar; Handle: Longint; Len:
Longint; Data: PChar): Bool;
The GetFileVersionlnfo function returns version information about the
specified file. The application must call the GetFileVersionlnfoSize
function before calling GetFileVersionlnfo to obtain the appropriate
handle if the handle is not NULL.
Parameters
IpszFileName
handle
version information.
cbBuf
IpvData
Return Value
Chapter 4, Functions
253
GetFile VersionlnfoSize
Comments
See Also
GetFileVersionlnfoSize, VerQueryValue
3.1
GetFileVersionlnfoSize
Syntax
#inc1ude <ver.h>
DWORD GetFileVersionlnfoSizeOpszFileNarne, lpdw Handle)
function GetFileVersionlnfoSize(FileName: PChar; var Handle: Longint):
Longint;
The GetFileVersionlnfoSize function determines whether it can obtain
version information from the specified file. If version information is
available, GetFileVersionlnfoSize returns the size of the buffer required to
hold the version information. It also returns a handle that can be used in a
subsequent call to the GetFileVersionlnfo function.
Parameters
Return Value
Comments
See Also
IpszFileName
IpdwHandle
The return value is the buffer size, in bytes, required to hold the version
information if the function is successful. The return value is NULL if the
function could not find the file, could not find the version information, or
produced an MS-DOS error. The GetFileVersionlnfoSize function returns
no information about the type of error that occurred.
The file version information is organized in a VS_VERSION_INFO block.
GetFileVersionlnfo
GetFontData
Syntax
3.1
DWORD GetFontData(hdc, dwTable, dwOffset, IpvBuffer, cbData)
function GetFontData(hdc: HDC; dwTable, dwOffset: Longint; IpvBuffer:
PChar; cbData: Longint): Longint;
254
GetFontOata
Return Value
Comments
hdc
dwTable
dwOffset
IpvBuffer
cbData
The return value specifies the number of bytes returned in the buffer
pointed to by the IpvBuffer parameter, if the function is successful.
Otherwise, it is -1.
An application can sometimes use the GetFontData function to save a
TrueType font with a document. To do this, the application determines
whether the font can be embedded and then retrieves the entire font file,
specifying zero for the dwTable, dwOffset, and cbData parameters.
Applications can determine whether a font can be embedded by checking
the otmfsType member of the OUTLINETEXTMETRIC structure. If bit 1 of
otmfsType is set, embedding is not permitted for the font. If bit 1 is clear,
the font can be embedded. If bit 2 is set, the embedding is read-only.
If an application attempts to use this function to retrieve information for a
non-TrueType font, the GetFontData function returns -1.
Chapter 4, Functions
255
GetFontOata
Example
*/
*/
"cmap"i
* (LPDWORD) lpszTable;
See Also
256
GetOutiineTextMetrics
GetFreeSystemResources
3.1
GetFreeFileHandles
Syntax
#inc1ude <stress.h>
int GetFreeFileHandles(void)
function GetFreeFileHandles: Integer;
The GetFreeFileHandles function returns the number of file handles
available to the current instance.
Parameters
Return Value
3.1
GetFreeSystemResources
Syntax
UINT GetFreeSystemResources(fuSysResource)
function GetFreeSystemResources(SysResource: Word): Word;
The GetFreeSystemResources function returns the percentage of free
space for system resources.
Parameters
Meaning
Return Value
The return value specifies the percentage of free space for resources, if the
function is successful.
Comments
Since the return value from this function does not guarantee that an
application will be able to create a new object, applications should not use
this function to determine whether it will be possible to create an object.
See Also
Chapter 4, Functions
GetFreeSpace
257
GetGlyphOutline
GetGlyphOutline
Syntax
3.1
Parameters
hdc
uChar
fuFormat
Meaning
258
/* gm */
GetGlyphOutline
cbBuffer
IpBuffer
Ipmat2
/* mat2 */
FIXED eMl1;
FIXED eM12;
FIXED eM21;
FIXED eM22;
MAT2;
Return Value
Comments
The return value is the size, in bytes, of the buffer required for the
retrieved information if the cbBuffer parameter is zero or the IpBuffer
parameter is NULL. Otherwise, it is a positive value if the function is
successful, or -1 if there is an error.
An application can rotate characters retrieved in bitmap format by
specifying a 2-by-2 transformation matrix in the structure pointed to by
the Ipmat2 parameter.
A glyph outline is returned as a series of contours. Each contour is
defined by a TTPOLYGONHEADER structure followed by as many
TTPOLYCURVE structures as are required to describe it. All points are
returned as POINTFX structures and represent absolute positions, not
relative moves. The starting point given by the pfxStart member of the
TTPOL YGONHEADER structure is the point at which the outline for a
contour begins. The TTPOLYCURVE structures that follow can be either
polyline records or spline records. Polyline records are a series of points;
lines drawn between the points describe the outline of the character.
Spline records represent the quadratic curves used by TrueType (that is,
quadratic b-splines).
Chapter 4, Functions
259
GetKerningPairs
88
TTPOLYGONHEADER #1
cb
= 44
dwType = 24
pfxStart = 1.000, 11.000
TTPOLYCURVE #1
wType = TT PRIM LINE
cpfx
= 3
pfx[O] = 1.000, 12.000
pfx[l] = 2.000, 12.000
pfx[2] = 2.000, 11.000
TTPOLYGONHEADER #2
cb
= 44
dwType = 24
pfxStart = 1.000, 0.000
TTPOLYCURVE #1
wType = TT PRIM LINE
cpfx
= 3
pfx[O] = 1.000, 9.000
pfx[l] = 2.000, 9.000
pfx[2] = 2.000, 0.000
See Also
*/
*/
*/
*/
*/
*/
GetOutlineTextMetrics
GetKerningPairs
Syntax
3.1
Parameters
hdc
cPairs
260
GetMsgProc
Ipkrnpair
Return Value
The return value specifies the number of kerning pairs retrieved or the
total number of kerning pairs in the font, if the function is successful. It is
zero if the function fails or there are no kerning pairs for the font.
GetMessageExtralnfo
Syntax
3.1
LONG GetMessageExtralnfo(void)
function GetMessageExtralnfo: Longint;
The GetMessageExtralnfo function retrieves the extra information
associated with the last message retrieved by the Get Message or
PeekMessage function. This extra information may be added to a
message by the driver for a pointing device or keyboard.
Parameters
Return Value
See Also
GetMsgProc
Syntax
3.1
LRESULT CALLBACK GetMsgProc(code, wParam, IParam)
The GetMsgProc function is a library-defined callback function that the
system calls whenever the GetMessage function has retrieved a message
from an application queue. The system passes the retrieved message to
the callback function before passing the message to the destination
window procedure.
Chapter 4, Functions
261
GetNextDriver
Parameters
code
wParam
IParam
/* msg */
MSG;
Return Value
Comments
GetNextDriver
Syntax
3.1
HDRVR GetNextDriver(hdrvr, fdwFlag)
function GetNextDriver(Driver: THandle; IParam: Longint): THandle;
The GetNextDriver function enumerates instances of an installable driver.
262
GetOpenClipboardWindow
hdrvr
fdwFlag
Parameters
Value
Meaning
GND_FIRSTINSTANCEONLY
GND_REVERSE
Return Value
The return value is the instance handle of the installable driver if the
function is successful.
GetOpenClipboardWindow
Syntax
3.1
HWND GetOpenClipboardWindow(void)
function GetOpenClipboardWindow: HWnd;
The GetOpenClipboardWindow function retrieves the handle of the
window that currently has the clipboard open.
Parameters
Return Value
See Also
Chapter 4, Functions
263
GefOpenFileName
3.1
GetOpenFileName
Syntax
#include <commdlg.h>
BOOL GetOpenFileN ame(lpofn)
function GetOpenFileN ame( var OpenFile: TOpenFilename): Bool;
The GetOpenFileName function creates a system-defined dialog box that
makes it possible for the user to select a file to open.
Parameters
[pofn
Return Value
264
The return value is nonzero if the user selects a file to open. It is zero if an
error occurs, if the user chooses the Cancel button, if the user chooses the
Close command on the System menu to close the dialog box, or if the
buffer identified by the IpstrFile member of the OPEN FILENAME
structure is too small to contain the string that specifies the selected file.
GefOpenFileName
Errors
Comments
Example
"Write Files (*. WRI) 1*. wri I Word Files (* .DOC) 1*. doc I"
The replaceable character at the end of the string is used to break the
entire string into separate strings, while still guaranteeing that all the
strings are continguous in memory.
OPENFILENAME ofni
char szDirName[256]i
char szFile[256] , szFileTitle[2561i
UINT i, cbStringi
char chReplacei
/* string separator for szFilter */
char szFilter[256]i
HFILE hfi
Chapter 4, Functions
265
GetOutlineTextMetrics
OFN_FILEMUSTEXISTi
if (GetOpenFileName(&ofn))
hf = _lopen(ofn.lpstrFile, OF_READ);
See Also
GetSaveFileName
3.1
GetOutlineTextMetrics
Syntax
Parameters
266
hdc
cbData
GetOutlineTextMetrics
Ipotm
Return Value
Comments
Chapter 4, Functions
267
GetQueueStatus
retrieve the required size by specifying NULL for the lpatm parameter in
the first call to the GetOutlineTextMetrics function.
See Also
GetTextMetrics
3.1
GetQueueStatus
Syntax
DWORD GetQueueStatus(fuFlags)
function GetQueueStatus(Flags: Word): Longint;
The GetQueueStatus function returns a value that indicates the type of
messages in the queue.
This function is very fast and is typically used inside speed-critical loops
to determine whether the GetMessage or PeekMessage function should
be called to process input.
GetQueueStatus returns two sets of information: whether any new
messages have been added to the queue since GetQueueStatus,
GetMessage, or PeekMessage was last called, and what kinds of events
are currently in the queue.
Parameters
fuFlags
Value
Meaning
QS_MOUSEMOVE
QS_MOUSEBUTTON
QS_PAINT
QS_POSTMSG
QS_SENDMSG
QS_TIMER
Return Value
268
The high-order word of the return value indicates the types of messages
currently in the queue. The low-order word shows the types of messages
added to the queue and are still in the queue since the last call to the
GetQueueStatus, GetMessage, or PeekMessage function.
GetRasterizerCaps
Comments
See Also
The existence of a QS_ flag in the return value does not guarantee that a
subsequent call to the PeekMessage or GetMessage function will return
a message. Get Message and PeekMessage perform some internal
filtering computation that may cause the message to be processed
internally. For this reason, the return value from GetQueueStatus should
be considered only a hint as to whether Get Message or PeekMessage
should be called.
GetlnputState, GetMessage, PeekMessage
GetRasterizerCaps
Syntax
3.1
Parameters
Ipraststat
cb
/* rs */
Return Value
Comments
See Also
Chapter 4, Functions
GetOutiineTextMetrics
269
GetSaveFileName
3.1
GetSaveFileName
Syntax
#include <commdlg.h>
BaaL GetSaveFileName(lpofn)
function GetSa veFileName( var OpenFile: TOpenFilename): Bool;
The GetSaveFileName function creates a system-defined dialog box that
makes it possible for the user to select a file to save.
Parameters
[pafn
Return Value
270
The return value is nonzero if the user selects a file to save. It is zero if an
error occurs, if the user clicks the Cancel button, if the user chooses the
Close command on the System menu to close the dialog box, or if the
buffer identified by the IpstrFile member of the OPENFILENAME
structure is too small to contain the string that specifies the selected file.
GetSaveFileName
Errors
Comments
message, this function must return a handle for the brush that should be
used to paint the control background.
Example
The replaceable character at the end of the string is used to break the
entire string into separate strings, while still guaranteeing that all the
strings are continguous in memory.
OPENFILENAME ofni
char szDirName[256]i
char szFile[256] , szFileTitle[256]i
UINT i, cbStringi
char chReplacei
/* string separator for szFilter */
char szFilter[256]i
HFILEhfi
/*
* Retrieve the system directory name and store it in
* szDirName.
Chapter 4, Functions
271
GetSelectorBase
*/
GetSystemDirectory(szDirName, sizeof(szDirName));
if ((cbString = LoadString(hinst, IDS_FILTERSTRING,
szFilter, sizeof(szFilter))) == 0) (
ErrorHandler();
return 0;
chReplace
See Also
GetOpenFileName
3.1
GetSelectorBase
Syntax
DWORD GetSelectorBase(uSelector)
function GetSelectorBase(Selector: Word): Longint;
The GetSelectorBase function retrieves the base address of a selector.
Parameters
272
uSelector
GetSystemDebugState
Return Value
See Also
GetSelectorLimit
Syntax
3.1
DWORD GetSelectorLimit(uSelector)
function GetSelectorLimit(Selector: Word): Longint;
The GetSelectorLimit function retrieves the limit of a selector.
Parameters
Return Value
See Also
uSelector
GetSystemDebugStote
Syntax
3.1
Parameters
Return Value
Meaning
SDS_MENU
SDS_SYSMODAL
SDS_NOTASKQUEUE
Menu is displayed.
System-modal dialog box is displayed.
Application queue does not exist yet and, therefore,
the application cannot accept posted messages.
Dialog box is displayed.
Current task is locked and, therefore, no other task is
permitted to run.
SDS_DIALOG
SDS_TASKISLOCKED
Chapter 4, Functions
273
GetSystemDir
GetSystemDir
Syntax
3.1
#include <ver.h>
UINT GetSystemDir{lpszWinDir,lpszBuf, cbBuf)
function GetSystemDir(AppDir: PChar; Buffer: PChar; Size: Integer):
Word;
The GetSystemDir function retrieves the path of the Windows system
directory. This directory contains such files as Windows libraries, drivers,
and fonts.
GetSystemDir is used by MS-DOS applications that set up Windows
Return Value
Comments
Ipsz WinDir
IpszBuf
cbBuf
The return value is the length of the string copied to the buffer, in bytes,
including the terminating null character, if the function is sucessful. If the
return value is greater than the cbBuf parameter, the return value is the
size of the buffer required to hold the path. The return value is zero if the
function fails.
An application must call the GetWindowsDir function before calling the
GetSystemDir function to obtain the correct IpszWinDirvalue.
The path that this function retrieves does not end with a backslash unless
the Windows system directory is the root directory. For example, if the
system directory is named WINDOWS\SYSTEM on drive C, the path of
the system directory retrieved by this function is
C: \ WINDOWS \SYSTEM.
See Also
274
GetSystemDirectory, GetWindowsDir
GetTextExtentPoint
3.1
GetTextExtentPoint
Syntax
Parameters
hdc
IpszString
cbString
IpSize
Return Value
Comments
See Also
Chapter 4, Functions
SetTextCharacterExtra
275
GetTimerResolution
3.1
GetTimerResolution
Syntax
OWORO GetTimerResolution(void)
function GetTimerResolution: Longint;
The GetTimerResolution function retrieves the number of microseconds
per timer tick.
Parameters
Return Value
See Also
3.1
GetViewportExtEx
Syntax
BOOL GetViewportExtEx(hdc,lpSize)
function GetViewportExtEx(OC: HOC; Size: PSize): Bool;
The GetViewportExtEx function retrieves the x- and y-extents of the
device context's viewport.
Parameters
Return Value
hdc
lpSize
3.1
GetViewportOrgEx
Syntax
Parameters
276
hdc
lpPoint
GefWinDebuglnfo
Return Value
3.1
GetWinDebuglnfo
BaaL GetWinDebuglnfoOpwdi, flags)
Syntax
Parameters
flags
Value
Meaning
WDCOPTIONS
WDCFILTER
WDCALLOCBREAK
members of WINDEBUGINFO.
Return Value
Comments
See Also
Chapter 4, Functions
SetWinDebuglnfo
277
GetWindowExtEx
GetWindowExtEx
Syntax
3.1
BaaL GetWindowExtEx(hdc,lpSize)
function GetWindowExtEx(DC: HDC; Size: PSize): Bool;
The GetWindowExtEx function retrieves the x- and y-extents of the
window associated with the specified device context.
Parameters
Return Value
hdc
IpSize
GetWindowOrgEx
Syntax
3.1
BaaL GetWindowOrgEx(hdc,lpPoint)
function GetWindowOrgEx(DC: HDC; Point: PPoint): Bool;
This function retrieves the x- and y-coordinates of the origin of the
window associated with the specified device context.
Parameters
hdc
IpPoint
Return Value
3.1
GetWindowPlacement
Syntax
278
GetWindowsDir
Parameters
hwnd
Ipwndpl
Return Value
See Also
/* wndpl */
GetWindowsDir
Syntax
3.1
#inc1ude <ver.h>
DINT GetWindowsDirOpszAppDir, IpszPath, cbPath)
function GetWindowsDir(AppDir: PChar; Buffer: PChar; Size: Integer):
Word;
The GetWindowsDir function retrieves the path of the Windows
directory. This directory contains such files as Windows applications,
initialization files, and help files.
GetWindowsDir is used by MS-DOS applications that set up Windows
Chapter 4, Functions
IpszAppDir
IpszPath
cbPath
279
GetWinMem32Version
Return Value
The return value is the length of the string copied to the IpszPath
parameter, including the terminating null character, if the function is
successful. If the return value is greater than the cbPath parameter, it is the
size of the buffer required to hold the path. The return value is zero if the
function fails.
Comments
The path that this function retrieves does not end with a backslash unless
the Windows directory is the root directory. For example, if the Windows
directory is named WINDOWS on drive C, the path retrieved by this
function is C: \ WINDOWS. If Windows is installed in the root directory of
drive C, the path retrieved is C: \ .
After the GetWindowsDir function locates the Windows directory, it
caches the location for use by subsequent calls to the function.
See Also
GetSystemDir, GetWindowsDirectory
GetWinMem32Version
Syntax
3.0
#include <winmem32.h>
WORD GetWinMem32Version(void)
function GetWinMem32Version: Word;
The GetWinMem32Version function retrieves the application
programming interface (API) version implemented by the
WINMEM32.DLL dynamic-link library. This is not the version number of
the library itself.
Parameters
Return Value
280
Giobal16PointerAlloc
Global 16PointerAlioc
Syntax
3.0
#include <winmem32.h>
WORD Gioba116PointerAllodwSelector, dwOffset,lpBuffer, dwSize,
wFlags)
function Globa116PointerAlloc(Selector: Word; dwOffset: Longint;
IpBuffer: PLongint; dwSize: Longint; wFlags: Word): Word;
The Giobal16PointerAiloc function converts a 16:32 pointer into a 16:16
pointer alias that the application can pass to a Windows function or to
other 16:16 functions.
Parameters
Return Value
wSelector
dwOffset
IpBuffer
dwSize
wFlags
Comments
Chapter 4, Functions
281
Giobal16PointerFree
Giobal16PointerFree
3.0
Giobal16PointerFree
Syntax
#include <winmem32.h>
WORD Globa116PointerFree(wSelector, dwAlias, wFlags)
function Globa116PointerFree(wSelector: Word; dwAlias: Longint;
wFlags: Word): Word; .
The Giobal16PointerFree function frees the 16:16 pointer alias previously
created by a call to the Giobal16PointerAlloc function.
Parameters
Return Value
wSelector
dwAlias
wFlags
282
Giobal32Alloc
WM32_Invalid_Flags
WM32_Invalid_Func
Comments
See Also
Giobal32Alloc
Syntax
3.0
#include <winmem32.h>
WORD GlobaI32Alloc(dwSize, IpSelector, dwMaxSize, wFlags)
function GlobaI32Alloc(dwSize: Longint; IpSelector: PWord; dwMaxSize,
wFlags :Word): Word;
The Giobal32Alloc function allocates a memory object to be used as a
16:32 (USE32) code or data segment and retrieves the selector portion of
the 16:32 address of the memory object. The first byte of the object is at
offset 0 from this selector.
Parameters
dwSize
ipSelector
dwMaxSize
wFlags
Chapter 4, Functions
283
Giobal32Alloc
Return Value
Comments
selector of the object. The valid range of offsets for the object referenced
by this selector is 0 through (but not including) dwSize.
In Windows 3.0 and later, the largest object that can be allocated is
OxOOFFOOOO (16 megabytes - 64K). This is the limitation placed on
WINMEM32.0LL by the current Windows kernel.
The returned selector identifies a descriptor for a data segment that has
the following attributes: read-write, expand-up, and big (B bit set). The
descriptor privilege level (OPL) and the granularity (the G bit) are set at
the system's discretion, so you should make no assumptions regarding
these settings. Because the system sets the granularity, the size of the
object (and the selector size limit) may ~e greater than the requested size
by up to 4095 bytes (4K minus 1). The OPL and requestor privilege level
(RPL) will be appropriate for a Windows application.
An application must not change the setting of any bits in the OPL or the
RPL selector. Doing so can result in a system crash and will prevent the
application from running on compatible platforms.
The allocated object is neither movable nor discardable but can be paged.
An application should not page-lock a 32-bit memory object. Page-locking
an object is useful only if the object contains code or data that is used at
interrupt time, and 32-bit memory cannot be used at interrupt time.
See Also
284
Global32Free, Giobal32Realioc
Giobal32CodeAlias
Giobal32CodeAlias
3.0
#include <winmem32.h>
WORD Globa132CodeAlias(wSelector,lpAlias, wFlags)
Syntax
wSelector
IpAlias
wFlags
Parameters
Return Value
If the function fails, the value pointed to by the IpAlias parameter is zero.
If the function is successful, IpAlias points to a USE32 code-segment alias
for the object specified by the wSelector parameter. The first byte of the
object is at offset 0 from the selector returned in IpAlias. Valid offsets are
determined by the size of the object as set by the most recent call to the
Giobal32Alloc or Giobal32Realioc function.
Comments
The returned selector identifies a descriptor for a code segment that has
the following attributes: read-execute, nonconforming, and USE32 (D bit
set). The descriptor privilege level (DPL) and the granularity (the G bit)
are set at the system's discretion, so you should make no assumptions
regarding their settings. The granularity will be consistent with the
current data selector for the object. The DPL and requestor privilege level
(RPL) are appropriate for a Windows application.
Chapter 4, Functions
285
Giobal32CodeAliasFree
An application must not change the setting of any bits in the DPL or the
RPL selector. Doing so can result in a system crash and will prevent the
application from running on compatible platforms.
An application should not call this function more than once for an object.
Depending on the system, the function might fail if an application calls it
a second time for a given object without first calling the
Giobal32CodeAliasFree function for the object.
See Also
Global32Alloc, Giobal32CodeAliasFree
3.0
Giobal32CodeAliasFree
Syntax
#inc1ude <winmem32.h>
WORD GlobaI32CodeAliasFree(wSelector, wAlias, wFlags)
function GlobaI32CodeAliasFree(wSelector, wAlias, wFlags: Word): Word;
The Giobal32CodeAliasFree function frees the 16:32 (USE32)
code-segment alias selector previously created by a call to the
Giobal32CodeAlias function.
Parameters
Return Value
wSelector
wAlias
wFlags
See Also
286
Giobal32CodeAlias
Giobal32Realloc
Giobal32Free
Syntax
3.0
#include <winmem32.h>
WORD Globa132Free(wSelector, wFlags)
function Globa132Free(wSelector, wFlags: Word): Word;
The Giobal32Free function frees an object previously allocated by the
Giobal32Alloc function.
Parameters
Return Value
wSelector
wFlags
Comments
The Giobal32Alloc function frees the object itself; it also frees all aliases
created for the object by the 32-bit memory application programming
interface (API).
Before terminating, an application must call this function to free each
object allocated by the Giobal32Alloc function to ensure that all aliases
created for the object are freed.
See Also
Giobal32Alloc, Giobal32Realloc
Giobal32Realioc
Syntax
3.0
#include <winmem32.h>
WORD Globa132Realloc(wSelector, dwNewSize, wFlags)
function Globa132Realloc{wSelector: Word; swNewSize: Longint; wFlags:
Word): Word;
Chapter 4, Functions
287
Giobal32Realloc
Return Value
wSelector
dwNewSize
wFlags
Comments
If this function fails, the previous state of the object is unchanged. If the
function succeeds, it updated the state of the object and the state of all
aliases to the object created by the 32-bit memory application
programming interface (API) functions. For this reason, an application
must call the the Giobal32Realloc function to change the size of the
object. Using other Windows functions to manipulate the object results in
corrupted aliases.
This function does not change the selector specified by the wSelector
parameter. If this function succeeds, the new valid range of offsets for the
selector is zero through (but not including) dwNewSize.
The system determines the appropriate granularity of the object. As a
result, the size of the object (and the selector size limit) may be greater
than the requested size by up to 4095 bytes (4K minus 1).
See Also
288
Global32Alloc, Giobal32Free
GlobalEntryHandle
3.1
GlobalEntryHandle
Syntax
#include <toolhelp.h>
BOOL GlobalEntryHandleOpge, hglb)
function GlobalEntryHandleOpGlobal: PGlobalEntry; hltem: THandle):
Bool;
The GlobalEntryHandle function fills the specified structure with
information that describes the given global memory object.
Parameters
Ipge
hglb
/* ge */
Return Value
Comments
See Also
Chapter 4, Functions
289
GlobalEntryModule
GlobalEntryModule
Syntax
3.1
#include <toolhelp.h>
BaaL GlobalEntryModuleOpge, hmod, wSeg)
function GlobalEntryModuleOpGlobal: PGlobalEntry; hModule: THandle;
wSeg: Word): Bool;
The GlobalEntryModule function fills the specified structure by lpge with
information about the specified module segment.
Parameters
lpge
Return Value
Comments
290
/* ge */
hmod
wSeg
GlobalFirst
Typically, the debugger will have symbols that refer to segment numbers;
this function translates the segment numbers to heap information.
Before calling GlobalEntryModule, an application must initialize the
GLOBALENTRY structure and specify its size, in bytes, in the dwSize
member.
See Also
GlobalFirst
Syntax
3.1
#include <toolhelp.h>
BOOL GlobalFirst(lpge, wFlags)
function GlobalFirst(lpGlobal: PGlobalEntry; wFlags: Word): Bool;
The GlobalFirst function fills the specified structure with information that
describes the first object on the global heap.
Parameters
Ipge
. wFlags
Chapter 4, Functions
/* ge */
291
GlobalHandleToSel
Value
Meaning
Comments
See Also
GlobalHandleToSel
Syntax
3.1
#include <toolhelp.h>
WORD GlobalHandleToSel(hglb)
function GlobalHandleToSel(hMem: THandle): Word;
The GlobalHandleToSel function converts the given handle to a selector.
Parameters
Return Value
Comments
See Also
292
hglb
The return value is the selector of the given object if the function is
successful. Otherwise, it is zero.
The GlobalHandleToSel function converts a global handle to a selector
appropriate for Windows, version 3.0 or 3.1, depending on which version
is running. A debugging application might use this selector to access a
global memory object if the object is not discardable or if the object's
attributes are irrelevant.
GlobalAlloc
GlobalNext
3.1
Globallnfo
Syntax
#include <toolhelp.h>
BOOL GlobalInfo(lpgi)
function GlobalInfo(lpGlobalInfo: PGlobalInfo): Bool;
The Globallnfo function fills the specified structure with information that
describes the global heap.
Parameters
Ipgi
Return Value
Comments
/* gi */
See Also
3.1
GlobalNext
Syntax
#include <toolhelp.h>
BOOL GlobalNextOpge, flags)
function GlobalNextOpGlobal: PGlobalEntry; wFlags: Word): Bool;
The GlobalNext function fills the specified structure with information that
describes the next object on the global heap.
Chapter 4, Functions
293
GlobalNext
Parameters
lpge
flags
Meaning
GLOBAL_ALL
GLOBAL_LRU
Comments
Value
GLOBAL_FREE
Return Value
/* ge */
See Also
294
HardwareProc
2.x
GrayStringProc
Syntax
Parameters
Return Value
Comments
hdc
IpData
cch
GrayString
HardwareProc
Syntax
3.1
code
wParam
Parameters
Chapter 4, Functions
295
hardware_event
IParam
Return Value
Comments
/* hhs */
The callback function should return zero to allow the system to process
the message; it should be 1 if the message is to be discarded.
This callback function should not install a playback hook because the
function cannot use the GetMessageExtralnfo function to get the extra
information associated with the message.
The callback function must use the Pascal calling convention and must be
declared FAR. An application must install the callback function by
specifying the WH_HARDWARE filter type and the procedure-instance
address of the callback function in a call to the SetWindowsHookEx
function.
HardwareProc is a placeholder for the library-defined function name. The
actual name must be exported by including it in an EXPORTS statement
in the library's module-definition (.DEF) file.
See Also
3.1
hardware_event
extrn hardware event :far
mov
mov
mov
mov
mov
eCall
ax, Msg
ex, ParamL
dx, ParamH
si, hwnd
di, wParam
hardware event
message
low-order word of lParam of the message
high-order word of lParam of the message
handle of the destination window
wParam of the message
296
hmemcpy
Parameters
Msg
ParamL
IParamH
hwnd
wParam
Return Value
Comments
See Also
GetMessageExtralnfo
hmemcpy
Syntax
3.1
void hmemcpy(hpvDest, hpvSource, cbCopy)
procedure hmemcpy(hpvDest, hpvSource: Pointer; cbeopy: Longint);
The hmemcpy function copies bytes from a source buffer to a destination
buffer. This function supports huge memory objects (that is, objects larger
than 64K, allocated using the GlobalAlioc function).
Parameters
hpvDest
hpvSource
Chapter 4, Functions
297
cbCopy
Return Value
See Also
_hread
3.1
Syntax
Parameters
hf
hpvBuffer
cbBuffer
Return Value
See Also
The return value indicates the number of bytes that the function read
from the file, if the function is successful. If the number of bytes read is
less than the number specified in cbBuffer, the function reached the end of
the file (EOF) before reading the specified number of bytes. The return
value is HFILE_ERROR if the function fails.
_Iread, hmemcpy, _hwrite
_hwrite
3.1
Syntax
Parameters
Return Value
298
hf
hpvBuffer
cbBuffer
The return value indicates the number of bytes written to the file, if the
function is successful. Otherwise, the return value is HFILE_ERROR.
InterruptRegister
Comments
See Also
The buffer specified by hpvBuffer cannot extend past the end of a segment.
hmemcpy, _hread, _Iwrite
3.1
InterruptRegister
Syntax
#inc1ude <toolhelp.h>
BOOL InterruptRegister(htask, IpfnIntCallback)
function InterruptRegister(hTask: THandle; IpfnIntCallBack:
TIntCallBack): Bool;
The InterruptRegister function installs a callback function to handle all
system interrupts.
Parameters
htask
IpfnlntCallback
Return Value
Comments
ds,ax
Chapter 4, Functions
299
InterruptRegister
The SS and SP values will not be on the stack unless a low-stack fault
occurred. This fault is indicated by the high bit of the interrupt number
being set.
When Windows calls a callback function, the AX register contains the DS
value for the instance of the application that contains the callback
function. For more information about this process, see the
MakeProclnstance function.
Typically, an interrupt callback function is exported. If it is not exported,
the developer should verify that the appropriate stack frame is generated,
including the correct DS value.
An interrupt callback function must save and restore all register values.
The function must also do one of the following:
III
Execute an retf instruction if it does not handle the interrupt. The Tool
Helper library will pass the interrupt to the next appropriate handler in
the interrupt handler list.
II
EI
Correct the problem that caused the interrupt, clear the first 10 bytes of
the stack, and execute an iret instruction. This action will restart
execution at the specified address. An application may change this
address, if necessary.
II
300
InterruptRegister
Name
INT_DIVO
INT_1
INT_3
INT_UDINSTR
I NT_STKFAULT
INT_GPFAULT
INT_BADPAGEFAULT
INT_CTLALTSYS RQ
Number
a
1
3
6
12
13
14
256
Meaning
Divide-error exception
Debugger interrupt
Breakpoint interrupt
Invalid-opcode exception
Stack exception
General protection violation
Page fault not caused by normal
virtual-memory operation
User pressed CTRL+ALT+SYS RQ
Chapter 4, Functions
301
InterruptUnRegister
InterruptUnRegister
Syntax
3.1
#include <toolhelp.h>
BaaL InterruptUnRegister(htask)
function InterruptUnRegister(hTask: THandle): Bool;
The InterruptUnRegister function restores the default interrupt handle for
system interrupts.
Parameters
Return Value
Comments
See Also
302
htask
IsBadCodePfr
IsBadCodePtr
Syntax
3.1
BOOL IsBadCodePtr{lpfn)
function IsBadCodePtr{lpfn: TFarProc): Bool;
The IsBadCodePtr function determines whether a pointer to executable
code is valid.
Parameters
Return Value
See Also
Chapter 4, Functions
[pfn
Points to a function.
The return value is nonzero if the pointer is bad (that is, if it does not
point to executable code). The return value is zero if the pointer is good.
IsBadHugeReadPtr, IsBadHugeWritePtr,lsBadReadPtr,lsBadStringPtr,
Is BadWritePtr
303
IsBadHugeReadPtr
3.1
IsBadHugeReadptr
Syntax
Parameters
Return Value
See Also
Ip
cb
The return value is nonzero if the pointer is bad (that is, if it does not
point to readable memory of the specified size). The return value is zero if
the pointer is good.
IsBadCodePtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtr,
IsBadWritePtr
IsBadHugeWriteptr
Syntax
3.1
Parameters
Return Value
See Also
304
Ip
cb
The return value is nonzero if the pointer is bad (that is, if it does not
point to writable memory of the specified size). The return value is zero if
the pointer is good.
IsBadCodePtr, IsBadHugeReadPtr, IsBadReadPtr, IsBadStringPtr,
IsBadWritePtr
IsBodStringPfr
IsBadReadPtr
Syntax
3.1
BOOL IsBadReadPtr(lp, cb)
function IsBadReadPtr(lp: Pointer; cb: Word): Baal;
The IsBadReadPtr function determines whether a pointer to readable
memory is valid.
Parameters
Return Value
See Also
Ip
cb
The return value is nonzero if the pointer is bad (that is, if it does not
point to readable memory of the specified size). The return value is zero if
the pointer is good.
IsBadCodePtr, IsBadHugeReadPtr, IsBadHugeWritePtr,lsBadStringPtr,
IsBadWritePtr
IsBadStringPtr
Syntax
3.1
BOOL IsBadStringPtr(lpsz, cchMax)
function IsBadStringPtr(lpsz: PChar; cchMax: Word): Baal;
The IsBadStringPtr function determines whether a pointer to a string is
valid.
Parameters
Return Value
See Also
Chapter 4, Functions
Ipsz
cchMax
The return value is nonzero if the pointer is bad (that is, if it does not
point to a string of the specified size). The return value is zero if the
pointer is good.
IsBadCodePtr, IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr,
IsBadWritePtr
305
IsBodWritePfr
3.1
IsBadWritePtr
Syntax
Parameters
Return Value
See Also
Ip
cb
The return value is nonzero if the pointer is bad (that is, if it does not
point to writable memory of the specified size). The return value is zero if
the pointer is good.
IsBadCodePtr, IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr,
IsBadStringPtr
3.1
IsGDIObject
Syntax
BaaL IsGDIObject(hobj)
function IsGDIObject(Obj: THandle): Baal;
The IsGDIObject function determines whether the specified handle is not
the handle of a graphics device interface (GDI) object.
Parameters
Return Value
Comments
See Also
306
hobj
The return value is nonzero if the handle may be the handle of a GDI
object. It is zero if the handle is not the handle of a GDI object.
An application cannot use IsGDIObject to guarantee that a given handle is
to a GDI object. However, this function can be used to guarantee that a
given handle is not to a GDI object.
GetObject
JournalPlaybackProc
IsMenu
3.1
Syntax
BOOL IsMenu(hmenu)
function IsMenu(Menu: HMenu): Bool;
The IsMenu function determines whether the given handle is a menu
handle.
Parameters
Return Value
Comments
See Also
hmenu
The return value is zero if the handle is definitely not a menu handle. A
nonzero return value does not guarantee that the handle is a menu
handle, however; for nonzero return values, the application should
conduct further tests to verify the handle.
An application should use this function only to ensure that a given handle
is not a menu handle.
CreateMenu, CreatePopupMenu, DestroyMenu, GetMenu
IsTosk
3.1
Syntax
BOOL IsTask(htask)
function IsTask(Task: THandle): Bool;
The IsTask function determines whether the given task handle is valid.
Parameters
Return Value
htask
Identifies a task.
The return value is nonzero if the task handle is valid. Otherwise, it is zero.
JournalPlaybackProc
Syntax
3.1
Chapter 4, Functions
307
JournalPlaybackProc
Parameters
code
wParam
IParam
Return Value
Comments
1* em *1
The callback function should return a value that represents the amount of
time, in clock ticks, that the system should wait before processing the
message. This value can be computed by calculating the difference
between the time members of the current and previous input messages. If
the function returns zero, the message is processed immediately.
The JournalPlaybackProc function should copy an input message to the
IParam parameter. The message must have been recorded by using a
JournalRecordProc callback function, which should not modify the
message.
Once the function returns control to the system, the message continues to
be processed. If the code parameter is HC_SKIP, the filter function should
prepare to return the next recorded event message on its next call.
This callback function should reside in a dynamic-link library.
An application must install the callback function by specifying the
WH---10URNALPLAYBACK filter type and the procedure-instance
address of the callback function in a call to the SetWindowsHookEx
function.
JournalPlaybackProc is a placeholder for the library-defined function
name. The actual name must be exported by including it in an EXPORTS
308
JournalRecordProc
3.1
JournalRecordProc
Syntax
Parameters
code
wParam
IParam
/* msg */
MSG;
Return Value
Comments
Chapter 4, Functions
309
KeyboardProc
KeyboardProc
Syntax
3.1
LRESULT CALLBACK KeyboardProc(code, wParam, IParam)
The KeyboardProc function is a library-defined callback function that the
system calls whenever the application calls the GetMessage or
PeekMessage function and there is a WM_KEYUP or WM_KEYDOWN
keyboard message to process.
Parameters
code
wParam
IParam
0-15
16-23
24
25-26
27-28
29
30
31
310
Description
LibMain
Return Value
Comments
See Also
2.x
LibMain
Syntax
Parameters
hinst
wDataSeg
cbHeapSize
IpszCmdLine
Return Value
o.
Comments
Example
Chapter 4, Functions
311
LineDDAProc
GlobalFree(hgblClassStruct);
return (hinstLib? 1
See Also
0);
/* return 1
success; 0
fail */
LineDDAProc
Syntax
3.1
void CALLBACK LineDDAProc(xPos, yPos, IpData)
The LineDDAProc function is an application-defined callback function
that processes coordinates from the LineDDA function.
Parameters
312
xPos
yPos
IpData
LoadProc
Return Value
Comments
See Also
LineDDA
2.x
LoadProc
Syntax
Parameters
Return Value
Comments
hglbMem
hinst
hrsrcReslnfo
The return value is a global memory handle for memory that was
allocated using the GMEM_DDESHARE flag in the GlobalAlioc function.
If an attempt to lock the memory object identified by the hglbMem
parameter fails, this means the resource has been discarded and must be
reloaded.
LoadProc is a placeholder for the application-defined function name. The
actual name must be exported by including it in an EXPORTS statement
in the application's module-definition file.
See Also
Chapter 4, Functions
313
LocolFirst
LocalFirst
3.1
Syntax
#include <toolhelp.h>
BOOL LocalFirst(lple, hglbHeap)
function LocalFirst(lpLocal: PLocalEntry; hHeap: THandle): Bool;
The LocalFirst function fills the specified structure with information that
describes the first object on the local heap.
Parameters
Iple
hglbHeap
Return Value
Comments
/* Ie */
See Also
314
Locallnfo, LocalNext
LocalNext
Locallnfo
Syntax
3.1
#include <toolhelp.h>
BOOL LocalInfo(lpli, hglbHeap)
function LocalInfo(lpLocal: PLocalInfo; hHeap: THandle}: Bool;
The Locallnfo function fills the specified structure with information that
describes the local heap.
Parameters
Ipli
hglbHeap
/* li */
Return Value
Comments
See Also
LocalFirst, LocalNext
Local Next
Syntax
3.1
#include <toolhelp.h>
BOOL LocalNext(lple)
function LocalNext(lpLocal: PLocalEntry): Boolean;
The LocalNext function fills the specified structure with information that
describes the next object on the local heap.
Chapter 4, Functions
315
Locklnput
Parameters
Iple
Return Value
Comments
See Also
/* le */
Locklnput
Syntax
3.1
BOOL LockInput(hReserved, hwndInput, flock)
function LockInput(hl: THandle; hwndInput: HWnd; flock: Bool): Bool;
The Locklnput function locks input to all tasks except the current one, if
the fLock parameter is TRUE. The given window is made system modal;
that is, it will receive all input. If fLock is FALSE, Locklnput unlocks input
and restores the system to its unlocked state.
Parameters
Return Value
316
hReserved
hwndlnput
fLock
LockWindowUpdate
Comments
See Also
3.1
LockWindowUpdate
Syntax
BOOL LockWindowUpdate(hwndLock)
function LockWindowUpdate(Wnd: HWnd): Bool;
The LockWindowUpdate function disables or reenables drawing in the
given window. A locked window cannot be moved. Only one window
can be locked at a time.
Parameters
Return Value
Comments
hwndLock
While window updates are locked, the system keeps track of the
bounding rectangle of any drawing operations to device contexts
associated with a locked window. When drawing is reenabled, this
bounding rectangle is invalidated in the locked window and its child
windows to force an eventual WM_P AINT message to update the screen.
If no drawing has occurred while the window updates were locked, no
area is invalidated.
The LockWindowUpdate function does not make the given window
invisible and does not clear the WS_VISIBLE style bit.
Chapter 4, Functions
317
Log Error
LogError
Syntax
3.1
void LogError(uErr,lpvInfo)
procedure LogError(Err: Word; Info: Pointer);
The Log Error function identifies the most recent system error. An
application's interrupt callback function typically calls LogError to return
error information to the user.
Parameters
uE rr
Meaning
ERR_ALLOCRES
ERR_BADINDEX
AllocResource failed.
Bad index to GetClassLong,
GetClassWord, GetWindowLong,
GetWindowWord, SetClassLong,
SetClassWord, SetWindowLong,
or SetWindowWord.
ERR_BYTE
ERR_CREATEDC
ERR_CREATEDLG
ERR_CREATEDLG2
ERR_CREATEMENU
ERR_CREATEMETA
ERR_CREATEWND
ERR_DCBUSY
ERR_DELOBJSELECTED
ERR_DWORD
ERR_GALLOC
ERR_GLOCK
ERR_GREALLOC
ERR_LALLOC
ERR_LLOCK
ERR_LOADMENU
318
LogParamError
Value
ERR_LOADMODULE
ERR_LOADSTR
ERR_LOCKRES
ERR_LREALLOC
ERR_NESTEDBEGINPAINT
ERR_REGISTERCLASS
ERR_SIZE_MASK
ERR_STRUCEXTRA
ERR_WARNING
ERR_WORD
Ipvlnfo
Return Value
Comments
Meaning
LoadModule failed.
LoadString failed.
LockResource failed.
LocalReAlioc failed.
Program contains nested
BeginPaint calls.
RegisterClass failed because the
class is already registered.
Program is trying to select a
bitmap that is already selected.
Identifies which 2 bits of uErr
specify the size of the invalid
parameter.
Program is using unallocated
space.
A non-fatal error occurred.
Invalid 16-bit parameter.
See Also
LogParamError, NotifyRegister
LogParamError
Syntax
3.1
void LogParamError(uErr,lpfn,lpvParam)
procedure LogParamError(Err: Word; fn: TFarProc; Param: Pointer);
The LogParamError function identifies the most recent parameter
validation error. An application's interrupt callback function typically
calls LogParamError to return information about an invalid parameter to
the user.
Chapter 4, Functions
319
LogParamError
Parameters
uErr
Meaning
ERR_BAD_ATOM
ERR_BAD_CID
Invalid atom.
Invalid communications
identifier (CID).
Invalid x,y coordinates.
Invalid 32-bit flags.
Invalid 32-bit index or index
out-of-range.
Invalid 32-bit signed or
unsigned value.
Invalid bit flags.
Invalid function pointer.
Invalid graphics device
interface (GDI) object.
Invalid global handle.
Invalid generic handle.
Invalid bitmap handle.
Invalid brush handle.
Invalid cursor handle.
Invalid device context (DC)
handle.
Invalid driver handle.
Invalid handle of a
window-position structure.
Invalid file handle.
Invalid font handle.
Invalid icon handle.
Invalid instance handle.
Invalid menu handle.
Invalid metafile handle.
Invalid module handle.
Invalid palette handle.
Invalid pen handle.
Invalid region handle.
Invalid window handle.
Invalid index or index
out-of-range.
Invalid local handle.
ERR_BAD_COORDS
ERR_BAD_DFLAGS
ERR_BAD_DINDEX
ERR_BAD_FLAGS
ERR_BAD_FUNC_PTR
ERR_BAD _GDCOBJECT
ERR_BAD_GLOBAL_HANDLE
ERR_BAD_HANDLE
ERR_BAD_HBITMAP
ERR_BAD _HBRUSH
ERR_BAD_HCURSOR
ERR_BAD_HDC
ERR_BAD _HDRVR
ERR_BAD_HDWP
ERR_BAD_HFILE
ERR_BAD _HFONT
ERR_BAD_HICON
ERR_BAD_HINSTANCE
ERR_BAD_HMENU
ERR_BAD_HMETAFILE
ERR_BAD_HMODULE
ERR_BAD _HPALETTE
ERR_BAD_HPEN
ERR_BAD_HRGN
ERR_BAD_HWND
ERR_BAD_INDEX
320
LogParamError
Value
Meaning
ERR_BAD_PTR
ERR_BAD_SELECTOR
ERR_BAD_STRING_PTR
Invalid pointer.
Invalid selector.
Invalid zero-terminated string
pointer.
Invalid 16-bit signed or
unsigned value.
Invalid 8-bit parameter.
Invalid 32-bit parameter.
A parameter validation error
occurred. This flag is always
set.
Identifies which 2 bits of uErr
specify the size of the invalid
parameter.
An invalid parameter was
detected, but the error is not
serious enough to cause the
function to fail. The invalid
parameter is reported, but the
call runs as usual.
Invalid 16-bit parameter.
ERR_BYTE
ERR_DWORD
ERR_PARAM
ERR_WORD
lpfn
lpvParam
Return Value
Comments
Chapter 4, Functions
321
LlClose
See Also
default:
break;
LZClose
3.'
Syntax
#include <lzexpand.h>
void LZClose(hO
procedure LZClose(LZFile: Integer);
The LZClose function closes a file that was opened by the LZOpenFile or
OpenFile function.
Parameters
Return Value
hf
Comments
Example
322
LZCopy
See Also
LZCopy
3.1
Syntax
#include <lzexpand.h>
LONG LZCopy(hfSource, hfDest)
function LZCopy(Source, Dest: Integer): Longint;
The LZCopy function copies a source file to a destination file. If the source
file was compressed by Microsoft File Compression Utility
(COMPRESS.EXE), this function creates a decompressed destination file.
If the source file was not compressed, this function duplicates the original
file.
Parameters
Return Value
hfSource
hfDest
The return value is the size, in bytes, of the destination file if the function
is successful. Otherwise, it is an error value that is less than zero and may
be one of the following:
Value
Meaning
LZERROR_BADlNHANDLE
LZERROR_BADOUTHANDLE
LZERROR_GLOBALLOC
LZERROR_GLOBLOCK
LZERROR_READ
LZERROR_UNKNOWNALG
LZERROR_WRITE
Chapter 4, Functions
323
LZDone
Comments
Example
See Also
llDone
3.'
Syntax
#include <lzexpand.h>
void LZDone(void)
procedure LZDone;
The LZDone function frees buffers that the LZStart function allocated for
multiple-file copy operations.
Parameters
Return Value
324
LZlnit
Applications that copy multiple files should call LZStart before copying
the files with the CopyLZFile function. LZStart allocates buffers for the
file copy operations.
Comments
Example
char *szSrc[NUM_FILES]
{"readme. txt", "data. txt", "update. txt", "list. txt"};
char*szDest[NUM_FILES]=
{"readme.bak", "data.bak", "update.bak", "list.bak"};
OFSTRUCT ofStrSrc;
OFSTRUCT ofStrDest;
HFILE hfSrcFile, hfDstFile;
int i;
/* Allocate internal buffers for the CopyLZFile function. * /
LZStart();
/ * Open, copy, and then close the files. * /
for (i = 0; i < NUM_FILES; i++) {
hfSrcFile = LZOpenFile(szSrc[i], &ofStrSrc, OF_READ);
hfDstFile = LZOpenFile(szDest[i], &ofStrDest, OF_CREATE);
CopyLZFile(hfSrcFile, hfDstFile);
LZClose(hfSrcFile) ;
LZClose(hfDstFile) ;
LZDone () ; /* free the internal buffers * /
See Also
LZlnit
3.1
#include <lzexpand.h>
HFILE LZInit(hfSrc)
Syntax
hfSrc
Parameters
Return Value
The return value is the original file handle if the function is successful and
the file is not compressed. If the function is successful and the file is
compressed, the return value is a new file handle. If the function fails, the
Chapter 4, Functions
325
LZlnit
return value is an error value that is less than zero and may be one of the
following:
Value
Meaning
LZERROR_BADINHANDLE
LZERROR_GLOBALLOC
LZERROR_GLOBLOCK
LZERROR_READ
LZERROR_UNKNOWNALG
Comments
Example
hfCompFile = LZInit(hfSrcFile);
/* Retrieve the original name for the compressed file. * /
GetExpandedName(szSrc, szFileName);
/* Create the destination file using the original name. * /
hfDstFile = LZOpenFile(szFileName, &ofStrDest, OF_CREATE);
326
LZOpenFile
else {
. /* handle error condition */
while (cbRead == sizeof(abBufi
LZOpenFile
Syntax
3.1
#include <lzexpand.h>
HFILE LZOpenFile(lpszFile, lpof, style)
function LZOpenFile(FileName: PChar; var ReOpenBuf: TOFStruct; Style:
Word): Integer;
The LZOpenFile function creates, opens, reopens, or deletes the file
specified by the string to which IpszFile points.
Parameters
IpszFile
lpaf
style
Value
Meaning
OF_CANCEL
OF_CREATE
OF_DELETE
OF_EXIST
OF_PARSE
Chapter 4, Functions
327
LZOpenFile
Value
OF_READ
OF_READWRITE
OF_REOPEN
OF_SHARE_DENY_WRITE
Return Value
Meaning
Comments
If style is OF_READ (or OF_READ and any of the OF_SHARE_ flags) and
the file is compressed, LZOpenFile calls the LZlnit function, which
performs the required initialization for the decompression operations.
Example
The following example uses LZOpenFile to open a source file and create a
destination file into which the source file can be copied:
char szSrc[] = {"readme.txt"};
char s zDst [ ] = {" readme. bak" };
OFSTRUCT ofStrSrc;
OFSTRUCT ofStrDest;
HFlLE hfSrcFile, hfDstFile;
328
LZRead
See Also
LZlnit
LZRead
3.1
#include <lzexpand.h>
int LZRead(hf, IpvBuf, cb)
Syntax
Return Value
hf
IpvBuf
cb
The return value is the actual number of bytes read if the function is
successful. Otherwise, it is an error value that is less than zero and may be
any of the following:
Value
Meaning
LZERROR_BADINHANDLE
LZERROR_BADVALUE
LZERROR_GLOBLOCK
LZERROR_READ
LZERROR_UNKNOWNALG
Chapter 4, Functions
329
LZRead
Comments
If the file is not compressed, LZRead calls the _Iread function, which
performs the read operation.
If the file is compressed, LZRead emulates _I read on an expanded image
of the file and copies the bytes of data into the buffer to which IpvBuf
points.
If the source file was compressed by Microsoft File Compression Utility
(COMPRESS.EXE), the LZOpenFile, LZSeek, and LZRead functions can
be called instead of the OpenFile,_"seek, and _Iread functions.
Example
330
LlSeek
LZClose(hfSrcFile);
LZClose(hfDstFile);
See Also
LZSeek
3.1
Syntax
#include <lzexpand.h>
LONG LZSeek(hf, IOffset, nOrigin)
function LZSeek(LZFile: Integer; SeekTo: Longint; Mode: Integer):
Longint;
The LZSeek function moves a file pointer from its original position to a
new position.
Parameters
hf
1Offset
nOrigin
Meaning
1
2
Return Value
The return value is the offset from the beginning of the file to the new
pointer position, if the function is successful. Otherwise, it is an error
value that is less than zero and may be one of the following:
Value
Meaning
LZERROR_BADINHANDLE
LZERROR_BADVALUE
LZERROR_GLOBLOCK
Chapter 4, Functions
331
LZStart
Comments
If the file is not compressed, LZSeek calls the _lIseek function and moves
the file pointer by the specified offset.
If the file is compressed, LZSeek emulates _lIseek on an expanded image
of the file.
See Also
_lIseek
LZStart
3.1
Syntax
#inc1ude <lzexpand.h>
int LZStart(void)
function LZStart: Integer;
The LZStart function allocates the buffers that the CopyLZFile function
uses to copy a source file to a destination file.
Parameters
Return Value
Comments
Example
char *szSrc[NUM_FILES]
{"readme. txt", "data. txt", "update. txt", "list. txt"};
char*szDest[NUM_FILES]=
{"readme.bak", "data.bak", "update.bak", "list.bak"};
OFSTRUCT ofStrSrc;
OFSTRUCT ofStrDest;
HFILE hfSrcFile, hfDstFile;
int i;
/* Allocate internal buffers for the CopyLZFile function. * /
LZStart();
/* Open, copy, and then close the files. */
for (i = 0; i < NUM FILES; i++) {
hfSrcFile = LZopenFile(szSrc[i], &ofStrSrc, OF_READ);
332
MapWindowPoints
See Also
MapWindowPoints
Syntax
3.1
Parameters
hwndFrom
hwndTo
lppt
/* pt */
Chapter 4, Functions
/* rc */
333
MemManlnfo
cPoints
Return Value
See Also
MemManlnfo
Syntax
3.1
#include <toolhelp.h>
BaaL MemManInfo(lpmmi)
function MemManInfo(lpEnhMode: PMemManInfo): Bool;
The MemManlnfo function fills the specified structure with status and
performance information about the memory manager. This function is
most useful in 386 enhanced mode but can also be used in standard mode.
Parameters
Ipmmi
Return Value
Comments
334
MemoryRead
MemoryRead
Syntax
3.1
#include <toolhelp.h>
DWORD MemoryRead(wSel, dwOffset, IpvBuf, dwcb)
function MemoryRead(wSel: Word; dwOffset: Longint; IpBuffer: PChar;
dwcb: Longint): Longint;
The MemoryRead function copies memory from the specified global heap
object to the specified buffer.
Parameters
Return Value
Comments
wSel
dwOffset
IpvBuf
dwcb
The return value is the number of bytes copied from wSel to IpvBuf. If wSel
is invalid or if dwOffset is out of the selector's range, the return value is zero.
The MemoryRead function enables developers to examine memory
without consideration for selector tiling and aliasing. MemoryRead reads
memory in read-write or read-only objects. This function can be used in
any size object owned by any task. It is not necessary to compute selector
array offsets.
The MemoryRead and MemoryWrite functions are designed to read and
write objects loaded by the LoadModule function or allocated by the
GlobalAlioc function. Developers should not split off the selector portion
of a far pointer and use this as the value for wSel, unless the selector is
known to be on the global heap.
See Also
Chapter 4, Functions
MemoryWrite
335
MemoryWrite
3.1
MemoryWrite
Syntax
#include <toolhelp.h>
DWORD MemoryWrite(wSel, dwOffset,lpvBuf, dwcb)
function MemoryWrite(wSel: Word; dwOffset: Longint; IpBuffer: PChar;
dwcb: Longint): Longint;
The MemoryWrite function copies memory from the specified buffer to
the specified global heap object.
Parameters
Return Value
Comments
wSel
dwOffset
IpvBuf
dwcb
The return value is the number of bytes copied from IpvBuf to wSel. If the
selector is invalid or if dwOffset is out of the selector's range, the return
value is zero.
The MemoryWrite function enables developers to modify memory
without consideration for selector tiling and aliasing. MemoryWrite writes
memory in read-write or read-only objects. This function can be used in
any size object owned by any task. It is not necessary to make alias objects
writable or to compute selector array offsets.
The MemoryRead and MemoryWrite functions are designed to read and
write objects loaded by the LoadModule function or allocated by the
GlobalAlioc function. Developers should not split off the selector portion
of a far pointer and use this as the value for wSel, unless the selector is
known to be on the global heap.
See Also
336
MemoryRead
MessageProc
MessageProc
Syntax
3.1
LRESULT CALLBACK MessageProc(code, wParam, IParam)
The MessageProc function is an application- or library-defined callback
function that the system calls after a dialog box, message box, or menu
has retrieved a message, but before the message is processed. The callback
function can process or modify the messages.
Parameters
code
Meaning
MSGF_DIALOG BOX
IParam
hwnd;
UINT
message;
wParam;
lParam;
time;
pt;
WPARAM
LPARAM
DWORD
POINT
MSG;
Return Value
Comments
/* msg */
Chapter 4, Functions
337
ModuleFindHandle
CaliNextHookEx, SetWindowsHookEx
ModuleFindHandle
Syntax
3.1
#include <toolhelp.h>
HMODULE ModuleFindHandleOpme, hmod)
function ModuleFindHandleOpModule: PModuleEntry; hModule:
THandle): THandle;
The ModuleFindHandle function fills the specified structure with
information that describes the given module.
Parameters
Ipme
hmod
Return Value
Comments
The return value is the handle of the given module if the function is
successful. Otherwise, it is NULL.
The ModuleFindHandle function returns information about a currently
loaded module whose module handle is known.
This function can be used to begin a walk through the list of all currently
loaded modules. An application can examine subsequent items in the
module list by using the ModuleNext function.
338
ModuleFindName
ModuleFindName
Syntax
3.1
#include <toolhelp.h>
HMODULE ModuleFindName(lpme,lpszName)
function ModuleFindNameOpModule: PModuleEntry; IpstrName:
PChar): THandle;
The ModuleFindName function fills the specified structure with
information that describes the module with the specified name.
Parameters
lpme
lpszName
Return Value
Comments
The return value is the handle named in the IpszName parameter, if the
function is successful. Otherwise, it is NULL.
The ModuleFindName function returns information about a currently
loaded module by looking up the module's name in the module list.
This function can be used to begin a walk through the list of all currently
loaded modules. An application can examine subsequent items in the
module list by using the ModuleNext function.
Chapter 4, Functions
339
ModuleFirst
ModuleFirst
Syntax
3.1
#inc1ude <toolhelp.h>
BOOL ModuleFirst(lpme)
function ModuleFirstOpModule: PModuleEntry): Bool;
The ModuleFirst function fills the specified structure with information
that describes the first module in the list of all currently loaded modules.
Parameters
lpme
Return Value
Comments
See Also
340
ModuleNext
3.1
ModuleNext
Syntax
#include <toolhelp.h>
BOOL ModuleNext(lpme)
function ModuleNextOpModule: PModuleEntry): Bool;
The ModuleNext function fills the specified structure with information
that describes the next module in the list of all currently loaded modules.
Parameters
Ipme
Return Value
Comments
See Also
Chapter 4, Functions
341
MouseProc
3. 1
MouseProc
Syntax
Parameters
code
wParam
IParam
The callback function should return a to allow the system to process the
message; it should return 1 to discard the message.
Comments
See Also
342
NotifyProc
MoveToEx
Syntax
3.1
BOOL MoveToEx(hdc, nX, nY, IpPoint)
function MoveToEx(DC: HDC; nX, n Y: Integer; Point: PPoint): Bool;
The MoveToEx function moves the current position to the point specified
by the nX and nYparameters, optionally returning the previous position.
Parameters
hdc
nX
nY
IpPoint
Return Value
See Also
/* pt */
NotifyProc
Syntax
2.x
BOOL CALLBACK NotifyProc(hglbl)
The NotifyProc function is a library-defined callback function that the
system calls whenever it is about to discard a global memory object
allocated with the GMEM_NOTIFY flag.
Parameters
Return Value
Comments
Chapter 4, Functions
hglbl
The callback function should return nonzero if the system is to discard the
memory object, or zero if it should not.
The callback function is not necessarily called in the context of the
application that owns the routine. For this reason, the callback function
should not assume it is using the stack segment of the application. The
callback function should not call any routine that might move memory.
343
NotifyRegister
See Also
GlobalNotify
31
NotifyRegister
Syntax
#include <toolhelp.h>
BOOL NotifyRegister(htask, IpfnCallback, wFlags)
function NotifyRegister(hTask: THandle; Ipfn: TNotifyCallBack; wFlags:
Word): Bool;
The NotifyRegister function installs a notification callback function for the
given task.
Parameters
htask
IpfnCallback
wFlags
344
ds,ax
NotifyRegister
Value
NF_TASKSWITCH
Return Value
Callback Function
Meaning
Parameters
wID
Meaning
NFY_DELMODULE
NFY_FREESEG
NFY_INCHAR
NFY_OUTSTR
Chapter 4, Functions
345
NotifyRegister
Value
NFY_UNKNOWN
Meaning
NFY_LOGPARAMERROR
NFY_TASKIN
NFY_TASKOUT
Meaning
dwData
Return Value
Comments
See Also
346
OffsetViewporfOrgEx
NotifyUnRegister
Syntax
3.1
#include <toolhelp.h>
BaaL NotifyUnRegister(htask)
function NotifyU nRegister(hTask: THandle): Bool;
The NotifyUnRegister function restores the default notification handler.
Parameters
Return Value
Comments
See Also
htask
OffsetViewportOrgEx
Syntax
3.1
The new origin is the sum of the current origin and the nX and n Y values.
Parameters
Chapter 4, Functions
hdc
nX
nY
IpPoint
347
OffsetWindowOrgEx
Return Value
3.1
OffsetWindowOrgEx
Syntax
The new origin is the sum of the current origin and the nX and nYvalues.
Parameters
Return Value
348
hdc
nX
nY
IpPoint
OleActivate
3. 1
OleActivate
Syntax
#include <ole.h>
OLESTATUS OleActivate(lpObject, verb, fShow, ffakeFocus, hwnd,
lprcBound)
function OleActivate(Self: POleObject; Verb: Word; Show, TakeFocus:
Bool; hWnd: HWnd; Bounds: PRect): TOleStatus;
The OleActivate function opens an object for an operation. Typically, the
object is edited or played.
Parameters
Return Value
lpObject
verb
fShaw
[TakeFacus
hwnd
lprcBaund
Comments
Chapter 4, Functions
349
OleBlockServer
OleQueryOpen, OleSetData
OleBlockServer
Syntax
3.1
#include <ole.h>
OLESTATUS OleBlockServer(lhSrvr)
function OleBlockServer(Server: LHServer): TOleStatus;
The OleBlockServer function causes requests to the server to be queued
until the server calls the OleUnblockServer function.
Parameters
Return Value
Comments
IhSrvr
See Also
350
OleRegisterServer, OleUnblockServer
OleClone
OleClone
Syntax
3.1
#include <ole.h>
OLESTATUS OleCloneOpObject, IpClient, IhClientDoc, IpszObjname,
IplpObject)
function OleClone(OleObject: POleObject; Client: POleClient; ClientDoc:
LHClientDoc; ObjName: PChar; var OleObject: POleObject): TOleStatus;
The OleClone function makes a copy of an object. The copy is identical to
the source object, but it is not connected to the server.
Parameters
Return Value
IpObject
IpClient
IhClientDoc
IpszObjname
IplpObject
Comments
Client applications often use the OleClone function to support the Undo
command.
A client application can supply a new OLECLIENT structure for the
cloned object, if required.
See Also
Chapter 4, Functions
OleEqual
351
OleClose
OleClose
Syntax
3.1
#include <ole.h>
OLESTATUS OleCloseOpObject)
function OleClose(Self: POleObject): TOleStatus;
The OleClose function closes the specified open object. Closing an object
terminates the connection with the server application.
Parameters
Return Value
IpObject
See Also
3.1
OleCopyFromLink
Syntax
#include <ole.h>
OLESTATUS OleCopyFromLinkOpObject, IpszProtocol, IpClient,
IhClientDoc, IpszObjname, IplpObject)
function OleCopyFromLink(OleObject: POleObject; Protocol: PChar;
Client: POleClient; ClientDoc: LHClientDoc; ObjName: PChar; var
OleObject: POleObject): TOleStatus;
The OleCopyFromLink function makes an embedded copy of a linked
object.
Parameters
352
IpObject
IpszProtocol
IpClient
IhClientDoc
OleCopyToClipboard
Return Value
IpszObjname
IplpObject
Comments
See Also
OleCopyToClipboord
Syntax
3.1
#include <ole.h>
OLESTATUS OleCopyToClipboardOpObject)
function OleCopyToClipboardCSelf: POleObject): TOleStatus;
The OleCopyToClipboard function puts the specified object on the
clipboard.
Parameters
Return Value
IpObject
Comments
The client application should open and empty the clipboard, call the
OleCopyToClipboard function, and close the clipboard.
Chapter 4, Functions
353
OleCreate
3, 1
OleCreate
Syntax
#include <ole.h>
OLESTATUS OleCreate(lpszProtocol, IpClient, IpszClass, IhClientDoc,
IpszObjname, IplpObject, renderopt, cfFormat)
function OleCreate(Protocol: PChar; Client: POleClient; Class: PChar;
ClientDoc: LHClientDoc; ObjectName: PChar; var OleObject: POleObject;
RenderOpt: TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
The OleCreate function creates an embedded object of a specified class.
The server is opened to perform the initial editing.
Parameters
IpszProtocol
IpClient
IpszClass
IhClientDoc
IpszObjname
IplpObject
renderopt
Value
Meaning
olerender_draw
olerender_format
354
OleCreateFromClip
Return Value
Value
Meaning
olerender_none
CF_BITMAP, the library manages the data and draws the object. The
library does not support drawing for any other formats. The return value
is OLE_OK if the function is successful. Otherwise, it is an error value,
which may be one of the following:
OLE_ERROR_HANDLE
OLE_ERROR_NAME
OLE_ERROR_PROTOCOL
OLE_WAIT_FOR_RELEASE
Comments
See Also
OleCreateFromClip
Syntax
Chapter 4, Functions
3.1
#include <ole.h>
OLESTATUS OleCreateFromClipOpszProtocol, IpClient, IhClientDoc,
IpszObjname, IplpObject, renderopt, cfFormat)
355
OleCreateFromClip
IpszProtocol
IpClient
IhClientDoc
IpszObjname
IplpObject
renderopt
Meaning
olerender_draw
olerender_format
olerender_none
cfFormat
356
OleCreateFromFile
the library manages the data and draws the object. The
library does not support drawing for any other formats.
Return Value
Comments
The client application should open and empty the clipboard, call the
OleCreateFromClip function, and close the clipboard.
The olerender_none rendering option is typically used to support
hyperlinks. With this option, the client does not call OleDraw and calls
OleGetData only for ObjectLink, OwnerLink, and Native formats.
The olerender_format rendering option allows a client to compute data
(instead of painting it), use an unusual data format, or modify a standard
data format. With this option, the client does not call OleDraw. The client
calls OleGetData to retrieve data in the specified format.
The olerender_draw rendering option is the most typical option. It is the
easiest rendering option for the client to implement (the client simply calls
OleDraw), and it allows the most flexibility. An object handler can exploit
this flexibility to store no presentation data, a private presentation data
format, or several different formats that it can choose among dynamically.
Future implementations of object linking and embedding (OLE) may also
exploit the flexibility that is inherent in this option.
See Also
OleCreateFromFile
Syntax
3.1
#include <ole.h>
OLE STATUS OleCreateFromFile{lpszProtocol, IpClient, IpszClass,
IpszFile,lhClientDoc,lpszObjname, IplpObject, renderopt, cfFormat)
function OleCreateFromFile(Protocol: PChar; Client: POleClient; Class,
Chapter 4, Functions
357
OleCreateFromFile
IpszProtocol
IpClient
IpszClass
IpszFile
IhClientDoc
IpszObjname
IplpObject
renderopt
Meaning
olerender_draw
olerender_format
358
OleCreateFromFile
cfFormat
Return Value
Value
Meaning
olerender_none
Comments
Chapter 4, Functions
359
OleCreateFromTemplate
OleCreateFromTemplate
Syntax
3.1
#include <ole.h>
OLESTA TUS OleCreateFromTemplate(lpszProtocol, IpClient,
IpszTemplate, IhClientDoc, IpszObjname, IplpObject, renderopt, cfFormat)
function OleCreateFromTemplate(Protocol: PChar; Client: POleClient;
Template: PChar; ClientDoc: LHClientDoc; ObjName: PChar; var
OleObject: POleObject; RenderOpt: TOleOPT_Render; Format:
TOleClipFormat): TOleStatus;
The OleCreateFromTemplate function creates an object by using another
object as a template. The server is opened to perform the initial editing.
Parameters
360
IpszProtocol
IpClient
IpszTemplate
IhClientDoc
IpszObjname
IplpObject
renderopt
OleCreateFromTemplate
Value
Meaning
olerender_draw
olerender_format
olerender_none
cfFormat
Return Value
OLE_ERROR_CLASS
OLE_ERROR_HANDLE
OLE_ERROR_MEMORY
OLE_ERROR_NAME
OLE_ERROR_PROTOCOL
OLE_WAIT_FOR_RELEASE
The client library uses the filename extension of the file specified in the
IpszTemplate parameter to identify the server for the object. The
association between the extension and the server is stored in the
registration database.
Comments
Chapter 4, Functions
361
OleCreatelnvisible
3.1
OleCreatelnvisible
Syntax
#include <ole.h>
OLESTATUS OleCreateInvisible{lpszProtocol, IpClient, IpszClass,
IhClientDoc, IpszObjname, IplpObject, renderopt, cfFormat, fActivate)
function OleCreateInvisible(Protocol: PChar; Client: POleClient; Class:
PChar; ClientDoc: LHClientDoc; ObjName: PChar; var OleObject:
POleObject; RenderOpt: TOleOPT_Render; Format: TOleClipFormat;
Activate: Bool): TOleStatus;
The OleCreatelnvisible function creates an object without displaying the
server application to the user. The function either starts the server to
create the object or creates a blank object of the specified class and format
without starting the server.
Parameters
362
IpszProtocol
IpClient
IpszClass
IhClientDoc
IpszObjname
OleCreatelnvisible
IplpObject
renderopt
Meaning
olerender_draw
olerender_format
olerender_none
Chapter 4, Functions
cfFormat
fActivate
363
OleCreateLinkFromClip
Return Value
Comments
See Also
3.1
OleCreateLinkFromClip
Syntax
#include <ole.h>
OLESTATUS OleCreateLinkFromClipOpszProtocol, IpClient,
IhClientDoc, IpszObjname, IplpObject, renderopt, cfFormat)
function OleCreateLinkFromClip(Protocol: PChar; Client: POleClient;
ClientDoc: LHClientDoc; ObjectName: PChar; var OleObject: POleObject;
RenderOpt: TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
The OleCreateLinkFromClip function typically creates a link to an object
from the clipboard.
Parameters
364
IpszProtocol
IpClient
IhCIientDoc
IpszObjname
OleCreateLinkFromClip
IplpObject
renderopt
Meaning
olerender_draw
olerender_format
olerender_none
cfFormat
Return Value
Comments
Chapter 4, Functions
365
OleCreateLinkFromFile
OleCreateLinkFromFile
Syntax
3.1
#include <ole.h>
OLESTATUS OleCreateLinkFromFile(lpszProtocol, IpClient, IpszClass,
IpszFile, IpszItem, IhClientDoc, IpszObjname, IplpObject, renderopt,
cfFormat)
function OleCreateLinkFromFile(Protocol: PChar; Client: POle Client;
Class, OleFile, Item: PChar; ClientDoc: LHClientDoc; ObjName: PChar;
var OleObject: POleObject; RenderOpt: TOleOPT_Render; Format:
TOleClipFormat): TOleStatus;
The OleCreateLinkFromFile function creates a linked object from a file
that contains an object. If necessary, the library starts the server to render
the presentation data, but the object is not shown in the server for editing.
Parameters
366
IpszProtocol
IpClient
IpszClass
IpszFile
IpszItem
OleCreateLinkFromFile
IhClientDoc
IpszObjname
IplpObject
renderopt
Meaning
olerender_draw
olerender_format
olerender_none
cfFormat
Return Value
Comments
Chapter 4, Functions
367
OleDelete
OleDelete
Syntax
3.1
#include <ole.h>
OLESTATUS OleDelete(lpObject)
function OleDelete(Self: POleObject): TOleStatus;
The OleDelete function deletes an object and frees memory that was
associated with that object. If the object was open, it is closed.
Parameters
Return Value
IpObject
Comments
See Also
368
OleClose, OleRelease
OleDraw
OleDraw
Syntax
3.1
#include <ole.h>
OLE STATUS OleOraw(lpObject, hdc, IprcBounds, IprcWBounds,
hdcFormat)
function OleOraw(Self: POleObject; DC: HOC; var Bounds, WBounds,
TRect; FormatOC: HOC): TOleStatus;
The Ole Draw function draws a specified object into a bounding rectangle
in a device context.
Parameters
Return Value
lpObject
hdc
lprcBounds
lprc WBounds
hdcFormat
Comments
Chapter 4, Functions
369
OleEnumFormats
The library may use an object handler to render the object, and this object
handler may need information about the target device. Therefore, the
device-context handle specified by the hdcFormat parameter is required.
The IprcBounds parameter identifies the rectangle on the device context
(relative to its current mapping mode) that the object should be mapped
onto. This may involve scaling the picture and can be used by client
applications to impose a view scaling between the displayed view and the
final printed image.
An object handler should format an object as if it were to be drawn at the
size specified by a call to the OleSetBounds function for the device
context specified by the hdcFormat parameter. Often this formatting will
already have been done by the server application; in this case, the library
simply renders the presentation data with suitable scaling for the
required bounding rectangle. If cropping or banding is required, the
device context in which the object is drawn may include a clipping region
smaller than the specified bounding rectangle.
See Also
OleSetBounds
OleEnumFormats
Syntax
3.1
#include <ole.h>
OLECLIPFORMAT OleEnumFormats(lpObject, cfFormat)
function OleEnumFormats(Self: POleObject; Format: TOleClipFormat):
TOleClipFormat;
The OleEnumFormats function enumerates the data formats that describe
a specified object.
Parameters
Return Value
Comments
370
IpObject
cfFormat
The return value is the next available format if any further formats are
available. Otherwise, the return value is NULL.
When an application specifies NULL for the cfFormat parameter, the
OleEnumFormats function returns the first available format. Whenever
an application specifies a format that was returned by a previous call to
OleEnumFormats, the function returns the next available format, in
OleEnumObjects
OleGetData
3.1
OleEnumObjects
Syntax
#inc1ude <ole.h>
OLESTATUS OleEnumObjects(lhDoc, IplpObject)
function OleEnumObjects(ClientDoc: LHClientDoc; var OleObject:
POleObject): TOleStatus;
The OleEnumObjects function enumerates the objects in a specified
document.
Parameters
Return Value
IhDoc
IplpObject
Comments
See Also
Chapter 4, Functions
OleDelete, OleRelease
371
OleEqual
3.1
OleEqual
Syntax
#include <ole.h>
OLE STATUS OleEqualOpObjectl, IpObject2)
function OleEqual(Self: POleObject; OleObject: POleObject): TOleStatus;
The OleEqual function compares two objects for equality.
Parameters
Return Value
IpObjectl
IpObject2
The return value is OLE_OK if the specified objects are equal. Otherwise,
it is an error value, which may be one of the following:
OLE_ERROR_OBJECT
OLE_ERROR_NOT_EQUAL
Comments
See Also
Embedded objects are equal if their class, item, and native data are
identical. Linked objects are equal if their class, document, and item are
identical.
OleClone, OleQueryOutOfDate
3. 1
OleExecute
Syntax
#include <ole.h>
OLE STATUS OleExecute(lpObject, hglbCmds, reserved)
function OleExecute(Self: POleObject; Commands: THandle; Reserved:
Word): TOleStatus;
The OleExecute function sends dynamic data exchange (DDE) execute
commands to the server for the specified object.
Parameters
372
IpObject
hglbCmds
reserved
OleGetOoto
Return Value
Comments
See Also
3. 1
OleGetData
Syntax
#include <ole.h>
OLESTATUS OleGetData(lpObject, cfFormat, IphData)
function OleGetData(Self: POleObject; Format: TOleClipFormat; var Data:
THandle): TOleStatus;
The OleGetData function retrieves data in the requested format from the
specified object and supplies the handle of a memory or graphics device
interface (GDI) object containing the data.
Parameters
lpObject
cfFormat
lphData
Chapter 4, Functions
373
OleGetLinkUpdateOptions
Return Value
Comments
3.1
OleGetLinkUpdateOptions
Syntax
#include <ole.h>
OLESTATUS OleGetLinkU pdateOptions(lpObject, lp U pdateOpt)
function OleGetLinkUpdateOptions(Self: POleObject; var UpdateOpt:
TOleOpt_Update): TOleStatus;
The OleGetLinkUpdateOptions function retrieves the link-update options
for the presentation of a specified object.
Parameters
374
IpObject
IpUpdateOpt
OlelsDcMeta
Value
Meaning
oleupdate_always
oleupdate_oncall
oleupdate_onsave
Return Value
See Also
OleSetLinkUpdateOptions
OlelsDcMeta
Syntax
3.1
#include <ole.h>
BOOL OleIsDcMeta(hdc)
function OlelsDcMeta(DC: HDC): Bool;
The OlelsDcMeta function determines whether the specified device
context is a metafile device context.
Parameters
Return Value
Chapter 4, Functions
hdc
375
OleLoadFromStream
OleLoadFromStream
Syntax
3.'
#include <ole.h>
OLESTATUS OleLoadFromStream(lpStream, IpszProtocol, IpClient,
IhClientDoc, IpszObjname, IplpObject)
function OleLoadFromStream(Stream: POleStream; Protocol: PChar;
Client: POleClient; ClientDoc: LHClientDoc; ObjectName: PChar; var
OleObject: POleObject): TOleStatus;
The OleLoadFromStream function loads an object from the containing
document.
Parameters
Return Value
IpStream
IpszProtocol
IpClient
IhClientDoc
IpszObjname
IplpObject
376
OleLockServer
Comments
To load an object, the client application needs only the location of that
object in a file. A client typically loads an object only when the object is
needed (for example, when it must be displayed).
If an object cannot be loaded when the lpszProtocol parameter specifies
automatically makes the link between the client and server applications
when an application calls OleLoadFromStream.
See Also
OleQuerySize, OleSaveToStream
3. 1
OleLockServer
Syntax
#include <ole.h>
OLESTATUS OleLockServer(lpObject, IphServer)
function OleLockServer(OleObject: POleObject; var Server: LHServer):
TOleStatus;
The OleLockServer function is called by a client application to keep an
open server application in memory. Keeping the server application in
memory allows the client library to use the server application to open
objects quickly.
Parameters
Return Value
lpObject
lphServer
Comments
Chapter 4, Functions
377
OleObjectConvert
When OleLockServer is called more than once for a given server, even by
different client applications, the server's lock count is increased. Each call
to OleUnlockServer decrements the lock count. The server remains locked
until the lock count is zero. If the object identified by the lpObject
parameter is deleted before calling the OleUnlockServer function,
OleUnlockServer must still be called to decrement the lock count.
If necessary, a server can terminate even though a client has called the
OleLockServer function.
See Also
OleUnlockServer
OleObjectConvert
Syntax
3.1
#include <ole.h>
OLE STATUS OleObjectConvert(lpObject, IpszProtocol, IpClient,
IhClientDoc, IpszObjname, IplpObject)
function OleObjectConvert(OleObject: POleObject; Protocol: PChar;
Client: POleClient; ClientDoc: LHClientDoc; ObjName: PChar; var
OleObject: POleObject): TOleStatus;
The OleObjectConvert function creates a new object that supports a
specified protocol by converting an existing object. This function neither
deletes nor replaces the original object.
Parameters
lpObject
lpszProtocol
lpClient
lhClientDoc
378
lpszObjname
lplpObject
OleQueryBounds
Return Value
Comments
See Also
OleQueryBounds
Syntax
3.1
#include <ole.h>
OLE STATUS OleQueryBoundsOpObject, IpBounds)
function OleQueryBounds(Self: POleObject; var Bounds: TRect):
TOleStatus;
The OleQueryBounds function retrieves the extents of the bounding
rectangle on the target device for the specified object. The coordinates are
in MM_HlMETRlC units.
Parameters
IpObject
IpBoun~s
Meaning
reet.left
0
0
x-extent
y-extent
reeUop
reet.right
reet.bottom
Return Value
Chapter 4, Functions
379
OleQueryClientVersion
See Also
OleSetBounds, SetMapMode
OleQueryClientVersion
Syntax
3.1
#include <ole.h>
DWORD OleQueryClientVersion(void)
function OleQueryClientVersion: Longint;
The OleQueryClientVersion function retrieves the version number of the
client library.
Parameters
Return Value
See Also
OleQueryCreateFromClip
Syntax
3.1
#include <ole.h>
OLE STATUS OleQueryCreateFromClip{lpszProtocol, renderopt,
cfFormat)
function OleQueryCreateFromClip(Protocol: PChar; render_opt:
TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
The OleQueryCreateFromClip function checks whether the object on the
clipboard supports the specified protocol and rendering options.
Parameters
380
IpszProtocol
renderopt
OleQueryCreateFromClip
Value
Meaning
olerender_draw
olerender_format
olerender_none
cfFormat
Return Value
Comments
See Also
Chapter 4, Functions
381
OleQueryLinkFromClip
3.1
OleQueryLinkFromClip
Syntax
#include <ole.h>
OLE STATUS OleQueryLinkFromClip(lpszProtocol, renderopt, cfFormat)
function OleQueryLinkFromClip(Protocol: PChar; render_opt:
TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
The OleQueryLinkFromClip function checks whether a client application
can use the data on the clipboard to produce a linked object that supports
the specified protocol and rendering options.
Parameters
lpszProtocol
renderopt
Meaning
olerender_draw
olerender_format
olerender_none
cfFormat
Return Value
382
OleQueryName
Comments
See Also
3.1
OleQueryName
Syntax
#include <ole.h>
OLESTATUS OleQueryName(lpObject, IpszObject, IpwBuffSize)
function OleQueryName(Self: POleObject; Name: PChar; var NameSize:
Word): TOleStatus;
The OleQueryName function retrieves the name of a specified object.
Parameters
IpObject
IpszObject
IpwBuffSize
Chapter 4, Functions
383
OleQueryOpen
Return Value
See Also
3.1
OleQueryOpen
Syntax
#include <ole.h>
OLESTATUS OleQueryOpen(lpObject)
function OleQueryOpen(Self: POleObject): TOleStatus;
The OleQueryOpen function checks whether the specified object is open.
Parameters
Return Value
IpObject
See Also
OleActivate
3.1
OleQueryOutOfDate
Syntax
#include <ole.h>
OLESTATUS OleQueryOutOfDate(lpObject)
function OleQueryOutOfDate(Self: POleObject): TOleStatus;
The OleQueryOutOfDate function checks whether an object is out-of-date.
Parameters
Return Value
IpObject
384
OleQueryProtocol
Comments
See Also
OleEqual, OleUpdate
OleQueryProtocol
Syntax
3.1
#include <ole.h>
void FAR* OleQueryProtocol(lpobj, IpszProtocol)
function OleQueryProtocol(Self: POleObject; Protocol: PChar): Pointer;
The OleQueryProtocol function checks whether an object supports a
specified protocol.
Parameters
Ipobj
IpszProtocol
Return Value
Comments
Chapter 4, Functions
385
OleQueryReleaseError
Ole Execute
3.1
OleQueryReleaseError
Syntax
#include <ole.h>
OLE STATUS OleQueryReleaseErrorOpobj)
function OleQueryReleaseError(Self: POleObject): TOleStatus;
The OleQueryReleaseError function checks the error value for an
asynchronous operation on an object.
Parameters
Return Value
Comments
See Also
Ipobj
3.1
OleQueryReleaseMethod
Syntax
#include <ole.h>
OLE_RELEASE_METHOD OleQueryReleaseMethodOpobj)
function OleQueryReleaseMethod(Self: POleObject):
TOle_Release_Method;
The OleQueryReleaseMethod function finds out the operation that
finished for the specified object.
386
OleQueryReleaseMethod
Parameters
Return Value
Ipobj
The return value indicates the server operation (method) that finished. It
can be one of the following values:
Value
Server operation
OLE_ACTIVATE
OLE_CLOSE
OLE_COPYFROMLNK
OLE_CREATE
OLE_CREATEFROMFILE
OLE_CREATEFROMTEMPLATE
OLE_CREATEINVISIBLE
OLE_CREATELINKFROMFILE
OLE_DELETE
OLE_EMBPASTE
OLE_LNKPASTE
OLE_LOADFROMSTREAM
OLE_NONE
OLE_OTHER
Activate
Close
CopyFromLink (autoreconnect)
Create
CreateFromFile
CreateFromTemplate
CreateInvisible
CreateLinkFromFile
Object Delete
Paste and Update
PasteLink (autoreconnect)
LoadFromStream (autoreconnect)
No operation active
Other miscellaneous asynchronous
operations
Reconnect
OleRequestData
Run
Server is stopping
OleSetData
Setting update options
Show
Update
OLE_RECONNECT
OLE_REQUESTDATA
OLE_RUN
OLE_SERVERUNLAUNCH
OLE_SETDATA
OLE_SETUPDATEOPTIONS
OLE_SHOW
OLE_UPDATE
If the pointer passed in the Ipobj parameter is invalid, the function returns
OLE_ERROR_OBJECT.
Comments
See Also
Chapter 4, Functions
OleQueryReleaseError,OleQueryReleaseStatus
387
OleQueryReleaseStatus
OleQueryReleaseStatus
Syntax
3.1
#include <ole.h>
OLESTATUS OleQueryReleaseStatus{lpobj)
function OleQueryReleaseStatus(Self: POleObject): TOleStatus;
The OleQueryReleaseStatus function determines whether an operation
has finished for the specified object.
Parameters
Return Value
See Also
Ipobj
OleQueryServerVersion
Syntax
3.1
#include <ole.h>
DWORD OleQueryServerVersion(void)
function OleQueryServerVersion: Longint;
The OleQueryServerVersion function retrieves the version number of the
server library.
Parameters
Return Value
See Also
388
OleQueryType
3. 1
OleQuerySize
Syntax
#include <ole.h>
OLE STATUS OleQuerySize(lpObject, pdwSize)
function OleQuerySize(Self: POleObject; var Size: Longint): TOleStatus;
The OleQuerySize function retrieves the size of the specified object.
IpObject
pdwSize
Parameters
Return Value
See Also
OleLoadFromStream
3.1
OleQueryType
Syntax
#include <ole.h>
OLESTATUS OleQueryTypeOpObject, lpType)
function OleQueryType(Self: POleObject; var LinkType: Longint):
TOleStatus;
The OleQueryType function checks whether a specified object is
embedded, linked, or static.
Parameters
Chapter 4, Functions
IpObject
IpType
Meaning
aT_EMBEDDED
aT_LINK
aT_STATIC
Object is embedded.
Object is a link.
Object is a static picture.
389
OleReconnect
Return Value
See Also
OleEnumFormats
3.1
OleReconnect
Syntax
#include <ole.h>
OLESTATUS OleReconnect(lpObject)
function OleReconnect(Self: POleObject): TOleStatus;
The OleReconnect function reestablishes a link to an open linked object.
If the specified object is not open, this function does not open it.
Parameters
Return Value
lpObject
Comments
See Also
OleRegisterClientDoc
Syntax
3.1
#include <ole.h>
OLESTA TUS OleRegisterClientDoc(lpszClass, IpszDoc, reserved, IplhDoc)
function OleRegisterClientDoc(Class, Doc: PChar; Reserved: Longint; var
Doc: LHClientDoc): TOleStatus;
390
OleRegisterServer
IpszClass
IpszDoc
reserved
IplhDoc
Parameters
Return Value
Comments
When a document being copied onto the clipboard exists only because the
client application is copying Native data that contains objects, the name
specified in the IpszDoc parameter must be Clipboard.
Client applications should register open documents with the library and
notify the library when a document is renamed, closed, saved, or restored
to a changed state.
See Also
OleRegisterServer
Syntax
3.1
#include <ole.h>
OLESTATUS OleRegisterServer(lpszClass, lpsrvr, lplhserver, hinst,
srvruse)
function OleRegisterServer(Class: PChar; ServerDef: POleServer; var
Server: LHServer; Inst: THandle; Use: TOle_Server_Use): TOleStatus;
The OleRegisterServer function registers the specified server, class name,
and instance with the server library.
Chapter 4, Functions
391
OleRegisterServer
Parameters
IpszClass
Ipsrvr
Iplhserver
Return Value
hinst
srvruse
Comments
See Also
392
OleRegisterServerDoc, OleRevokeServer
OleRegisterServerDoc
3.1
OleRegisterServerDoc
Syntax
#include <ole.h>
OLE STATUS OleRegisterServerDoc(lhsrvr, IpszDocN arne, lpdoc, lplhdoc)
function OleRegisterServerDocCServer: LHServer; DocName: PChar;
DocDef: POleServerDoc; var Doc: LHServerDoc): TOleStatus;
The OleRegisterServerDoc function registers a document with the server
library in case other client applications have links to it. A server
application uses this function when the server is started with the
IEmbedding filename option or when it creates or opens a document that is
not requested by the library.
Ihsrvr
Parameters
OLE_ERROR_ADDRESS
OLE_ERROR_HANDLE
OLE_ERROR_MEMORY
Comments
See Also
Chapter 4, Functions
OleRegisterServer,OleRevokeServerDoc
393
OleRelease
OleRelease
Syntax
3.1
#include <ole.h>
OLESTATUS OleRelease(lpObject)
function OleRelease(Self: POleObject): TOleStatus;
The OleRelease function releases an object from memory and closes it if it
was open. This function does not indicate that the object has been deleted
from the client document.
Parameters
Return Value
IpObject
See Also
The OleRelease function should be called for all objects when closing the
client document.
OleDelete
OleRename
Syntax
3.1
#include <ole.h>
OLESTATUS OleRename(lpObject, lpszNewname)
function OleRename(Self: POleObject; NewName: PChar): TOleStatus;
The Ole Rename function renames an object.
Parameters
Return Value
394
OleRenameClientDoc
Comments
Object names need not be seen by the user. They must be unique within
the containing document and must be preserved when the document is
saved.
See Also
OleQueryName
3.1
OleRenameClientDoc
Syntax
#include <ole.h>
OLE STATUS OleRenameClientDoc(lhClientDoc, IpszNewDocname)
function OleRenameClientDoc(ClientDoc: LHClientDoc; NewDocName;
PChar): TOleStatus;
The OleRenameClientDoc function informs the client library that a
document has been renamed. A client application calls this function when
a document name has changed-for example, when the user chooses the
Save or Save As command from the File menu.
Parameters
Return Value
Comments
See Also
Chapter 4, Functions
lhClientDoc
lpszNewDocname
395
OleRenameServerDoc
OleRenameServerDoc
Syntax
3.1
#include <ole.h>
OLESTATUS OleRenameServerDocOhDoc, lpszDocName)
function OleRenameServerDoc(Doc: LHServerDoc; NewName: PChar):
TOleStatus;
The OleRenameServerDoc function informs the server library that a
document has been renamed.
Parameters
Return Value
IhDoc
Identifies the document that has been renamed.
IpszDocName Points to a null-terminated string specifying the new name
of the document. This parameter is typically a fully
qualified path.
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value, which may be one of the following:
OLE_ERROR_HANDLE
OLE_ERROR_MEMORY
Comments
See Also
OleRequestData
Syntax
3.1
#include <ole.h>
OLESTA TUS OleRequestData(lpObject, cfFormat)
function OleRequestData(Self: POleObject; Format: TOleClipFormat):
TOleStatus;
396
OleRevertClientDoc
Return Value
lpObject
cfFormat
Comments
OleRevertClientDoc
Syntax
3.1
#include <ole.h>
OLESTATUS OleRevertClientDocOhClientDoc)
function OleRevertClientDoc(ClientDoc: LHClientDoc): TOleStatus;
The OleRevertClientDoc function informs the library that a document has
been restored to a previously saved condition.
Chapter 4, Functions
397
OleReverfServerDoc
Parameters
IhClientDoc
Return Value
Comments
See Also
Ole RevertServerDoc
Syntax
3.1
#include <ole.h>
OLESTATUS OleRevertServerDocOhDoc)
function OleRevertServerDodDoc: LHServerDoc): TOleStatus;
The OleRevertServerDoc function informs the server library that the
server has restored a document to its saved state without closing it.
Parameters
Return Value
Comments
See Also
398
IhDoc
OleRevokeObject
3.1
OleRevokeClientDoc
Syntax
#include <ole.h>
OLEsTATUs OleRevokeClientDocOhClientDoc)
function OleRevokeClientDodClientDoc: LHClientDoc): TOlestatus;
The OleRevokeClientDoc function informs the client library that a
document is no longer open.
Parameters
Return Value
IhClientDoc
Comments
The client application should delete all the objects in a document before
calling OleRevokeClientDoc.
Client applications should register open documents with the library and
notify the library when a document is renamed, closed, saved, or restored
to a changed state.
See Also
3.1
OleRevokeObject
Syntax
#inc1ude <ole.h>
OLE STATUS OleRevokeObject(lpClient)
function OleRevokeObject<Client: POleClient): TOlestatus;
The OleRevokeObject function revokes access to an object. A server
application typically calls this function when the user destroys an object.
Parameters
Chapter 4, Functions
IpClient
399
OleRevokeServer
Return Value
See Also
3.1
OleRevokeServer
Syntax
#include <ole.h>
OLESTATUS OleRevokeServerOhServer)
function OleRevokeServer(Server: LHServer): TOleStatus;
The OleRevokeServer function is called by a server application to close
any registered documents.
Parameters
Return Value
IhServer
Comments
See Also
3.1
OleRevokeServerDoc
Syntax
#include <ole.h>
OLESTATUS OleRevokeServerDocOhdoc)
function OleRevokeServerDoc(Doc: LHServerDoc): TOleStatus;
The OleRevokeServerDoc function revokes the specified document. A
server application calls this function when a registered document is being
closed or otherwise made unavailable to client applications.
400
OleSavedClientDoc
Parameters
Return Value
Ihdoc
Comments
3.1
OleSavedClientDoc
Syntax
#include <ole.h>
OLE STATUS OleSavedClientDoc(lhClientDoc)
function OleSavedClientDoc(ClientDoc: LHClientDoc): TOleStatus;
The OleSavedClientDoc function informs the client library that a
document has been saved.
Parameters
Return Value
Comments
See Also
Chapter 4, Functions
IhClientDoc
401
OleSavedServerDoc
OleSavedServerDoc
Syntax
3.1
#include <ole.h>
OLESTATUS OleSavedServerDodlhDoc)
function OleSavedServerDoc(Doc: LHServerDoc): TOleStatus;
The OleSavedServerDoc function informs the server library that a
document has been saved.
Parameters
Return Value
IhDoc
Comments
See Also
OleSaveToStream
Syntax
3.1
#include <ole.h>
OLESTATUS OleSaveToStream(lpObject,lpStream)
function OleSaveToStream(Self: POleObject; Stream: POleStream):
TOleStatus;
The OleSaveToStream function saves an object to the stream.
402
OleSetBounds
Parameters
Return Value
IpObject
IpStream
Comments
See Also
OleSetBounds
Syntax
3.1
#include <ole.h>
OLESTATUS OleSetBounds(lpObjed, IprcBound)
function OleSetBounds(Self: POleObject; var Bounds: TRect): TOleStatus;
The OleSetBounds function sets the coordinates of the bounding
rectangle for the specified object on the target device.
Parameters
Return Value
IpObject
IprcBound
Chapter 4, Functions
403
OleSetColorScheme
The OleSetBounds function is ignored for linked objects, because the size
of a linked object is determined by the source document for the link.
A client application uses OleSetBounds to change the bounding
rectangle. The client does not need to call OleSetBounds every time a
server is opened.
The bounding rectangle specified in the OleSetBounds function does not
necessarily have the same dimensions as the rectangle specified in the call
to the OleDraw function. These dimensions may be different because of
the view scaling used by the container application. An application can use
OleSetBounds to cause the server to reformat the picture to fit the
rectangle more closely.
In the MM_HIMETRIC mapping mode, the positive y-direction is up.
See Also
3.1
OleSetColorScheme
Syntax
#include <ole.h>
OLESTATUS OleSetColorSchemeOpObject, lpPalette)
function OleSetColorScheme{Self: POleObjecti var Palette: TLogPalette):
TOleStatusi
The OleSetColorScheme function specifies the palette a client application
recommends be used when the server application edits the specified
object. The server application can ignore the recommended palette.
Parameters
Return Value
IpObject
IpPalette
404
OleSetData
OLE_ERROR_OBJECT
OLE_ERROR_PALETTE
OLE_ERROR_STATIC
OLE_WAIT_FOR_RELEASE
The OleSetColorScheme function returns OLE_ERROR_OBJECT when it
is called for a linked object.
Comments
3. 1
OleSetData
Syntax
#include <ole.h>
OLESTATUS OleSetData(lpObject, cfFormat, hData)
function OleSetData(Self: POleObject; Format: TOleClipFormat; Data:
THandle): TOleStatus;
The OleSetData function sends data in the specified format to the server
associated with a specified object.
Parameters
Chapter 4, Functions
IpObject
c[Format
hData
405
OleSetHostNames
Return Value
See Also
OleGetData, OleRequestData
OleSetHostNames
Syntax
3.1
#include <ole.h>
OLE STATUS OleSetHostNames(lpObject, lpszClient, lpszClientObj)
function OleSetHostNames(Self: POleObject; ClientName, ObjectName:
PChar): TOleStatus;
The OleSetHostNames function specifies the name of the client
application and the client's name for the specified object. This information
is used in window titles when the object is being edited in the server
application.
Parameters
IpObject
IpszClient
406
OleSetLinkUpdateOptions
OleSetLinkUpdateOptions
Syntax
3.1
#include <ole.h>
OLESTATUS OleSetLinkUpdateOptions(lpObject, UpdateOpt)
function OleSetLinkUpdateOptions(Self: POleObject; UpdateOpt:
TOleOpt_Update): TOleStatus;
The OleSetLinkUpdateOptions function sets the link-update options for
the presentation of the specified object.
Parameters
IpObject
UpdateOpt
Description
oleupdate_always
oleupdate_oncall
oleupdate_onsave
Chapter 4, Functions
407
OleSetTargetDevice
Return Value
See Also
OleGetLinkUpdateOptions
OleSetTargetDevice
Syntax
3.1
#include <ole.h>
OLESTATUS OleSetTargetDevice(lpObject, hotd)
function OleSetTargetDevice(Self: POleObject; TargetDevice: THandle):
TOleStatus;
The OleSetTargetDevice function specifies the target output device for an
object.
Parameters
Return Value
IpObject
hotd
Comments
408
OleUnblockServer
library to redraw the object if it receives a notification from the server that
the object has changed.
A client application uses the OleSetTargetDevice function to change the
target device. The client does not need to call OleSetTargetDevice every
time a server is opened.
3.1
OleUnblockServer
Syntax
#include <ole.h>
OLE STATUS OleUnblockServer(lhSrvr, IpfRequest)
function OleUnblockServer(Server: LHServer; var Requests: Bool):
TOleStatus;
The OleUnblockServer function processes a request from a queue created
by calling the OleBlockServer function.
Parameters
Return Value
IhSrvr
IpfRequest
Comments
See Also
OleUnlockServer
OleUnlockServer
Syntax
3.1
#include <ole.h>
OLESTATUS OleU nlockServer(hServer)
function OleUnlockServer(Server: LHServer): TOleStatus;
The OleUnlockServer function unlocks a server that was locked by the
OleLockServer function.
Parameters
Return Value
hServer
Comments
When the OleLockServer function is called more than once for a given
server, the server's lock count is incremented. Each call to
OleUnlockServer decrements the lock count. The server remains locked
until the lock count is zero.
If the OleUnlockServer function returns OLE_WAIT_FOR_RELEASE, the
410
OleLockServer, OleQueryReleaseStatus
OpenDriver
OleUpdate
Syntax
3.1
#include <ole.h>
OLESTATUS OleUpdate(lpObject)
function OleUpdate(Self: POleObject): TOleStatus;
The OleUpdate function updates the specified object. This function
updates the presentation of the object and ensures that the object is
up-to-date with respect to any linked objects it contains.
lpObject
Parameters
Return Value
See Also
OleQueryOutOfDate
OpenDriver
3.1
HDRVR OpenDriver(lpDriverName, IpSectionName, IParam)
Syntax
Return Value
Chapter 4, Functions
lpDriverName
lpSectionName
lParam
411
PrintDlg
Comments
When an application opens a driver for the first time, Windows calls the
DriverProc function with the DRV_LOAD, DRV_ENABLE, and
DRV_OPEN messages. When subsequent instances of the driver are
opened, only DRV_OPEN is sent.
The value specified in the IParam parameter is passed to the IParam2
parameter of the DriverProc function.
See Also
CloseDriver, DriverProc
31
PrintDlg
Syntax
#inc1ude <commdlg.h>
BOOL PrintDlgOppd)
function PrintDlg(var PrintDlg: TPrintDlg): Bool;
The PrintDlg function displays a Print dialog box or a Print Setup dialog
box. The Print dialog box makes it possible for the user to specify the
properties of a particular print job. The Print Setup dialog box makes it
possible for the user to select additional job properties and configure the
printer.
Parameters
Ippd
412
PrintDlg
UINT
nFromPage;
UINT
nToPage;
UINT
nMinP age;
UINT
nMaxPage;
UINT
nCopies;
HINSTANCE hInstance;
LPARAM
lCustData;
UINT
(CALLBACK* lpfnPrintHook) (HWND,
UINT
(CALLBACK* lpfnSetupHook) (HWND,
LPCSTR
lpPrintTemplateName;
LPCSTR
lpSetupTemplateName;
HGLOBAL
hPrintTemplate;
HGLOBAL
hSetupTemplate;
PRINTDLG;
Return Value
Errors
Chapter 4, Functions
413
PrintDlg
CDERR_FINDRESFAILURE
CDERR_INITIALlZATION
CDERR_LOADRESFAILURE
CDERR_LOADSTRFAILURE
CDERR_LOCKRESFAILURE
CDERR_MEMALLOCFAILURE
CDERR_MEMLOCKFAILURE
CDERR_NOHINSTANCE
CDERR_NOHOOK
CDERR_NOTEMPLATE
CDERR_STRUCTSIZE
Example
PDERR_CREATEICFAILURE
PDERR_DEFAULTDIFFERENT
PDERR_DNDMMISMATCH
PDERR_GETDEVMODEFAIL
PDERR_INITFAILURE
PDERR_LOADDRVFAILURE
PDERR_NODEFAULTPRN
PDERR_NODEVICES
PDERR_PARSEFAILURE
PDERR_PRINTERNOTFOUND
PDERR_RETDEFFAILURE
PDERR_SETUPFAILURE
414
QuerySendMessage
QueryAbort
Syntax
3.1
BOOL QueryAbort(hdc, reserved)
function Query Abort(DC: HDC; Reserved: Integer): Bool;
The Query Abort function calls the AbortProc callback function for a
printing application and queries whether the printing should be
terminated.
Parameters
Return Value
See Also
hdc
message
3.1
QuerySendMessage
Syntax
Parameters
hreservedl
hreserved2
hreserved3
IpMessage
hwnd;
UINT
message;
/* msg */
WPARAM wParam;
LPARAM lParam;
DWORD
POINT
time;
pt;
MSG;
Chapter 4, Functions
415
RedrawWindow
Return Value
The return value is zero if the message originated within the current task.
Otherwise, it is nonzero.
Comments
function.
The NULL parameters are reserved for future use.
See Also
3.1
RedrawWindow
Syntax
Parameters
hwnd
IprcUpdate
416
/* rc */
hrgnUpdate
fuRedraw
RedrawWindow
Meaning
RDW_ERASE
RDW_FRAME
RDW_INTERNALPAINT
RDW_INVALIDATE
Meaning
RDW_NOERASE
RDW_NOFRAME
Chapter 4, Functions
417
RedrawWindow
Value
Meaning
RDW_NOINTERNALPAINT
RDW _VALIDATE
Meaning
RDW _ERASENOW
RDW _UPDATENOW
418
RegCloseKey
Value
Meaning
RDW _ALLCHILDREN
RDW _NOCHILDREN
Return Value
Comments
See Also
RegCloseKey
Syntax
3.1
#include <shellapi.h>
lONG RegCloseKey(hkey)
function RegCloseKey(Key: HKey): Longint;
The RegCloseKey function closes a key. Closing a key releases the key's
handle. When all keys are closed, the registration database is updated.
Parameters
Return Value
Comments
hkey
Chapter 4, Functions
419
RegCreateKey
Example
"newapp.exe" ,
10) ;
RegSetValue(hkProtocol,
"verb\ \0",
REG_SZ,
"EDIT",
4) ;
RegCloseKey(hkProtocol);
See Also
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
3.1
RegCreateKey
Syntax
*/
#include <shellapi.h>
LONG RegCreateKey(hkey, IpszSubKey, IphkResult)
function RegCreateKey(Key: HKey; SubKey: PChar; var Result: HKey):
Longint;
The RegCreateKey function creates the specified key. If the key already
exists in the registration database, RegCreateKey opens it.
Parameters
420
hkey
IpszSubKey
IphkResult
RegCreateKey
Return Value
Comments
subkeyl\subkey2\subkey3\subkey4
Example
RegSetValue(hkProtocol,
"verb\ \0",
REG_SZ,
"EDIT",
4) ;
RegCloseKey(hkProtocol);
See Also
Chapter 4, Functions
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
*/
421
RegDeleteKey
RegDeleteKey
Syntax
3.1
#include <shellapLh>
LONG RegDeleteKey(hkey, IpszSubKey)
function RegDeleteKey(Key: HKey; SubKey: PChar): Longint;
The RegDeleteKey function deletes the specified key. When a key is
deleted, its value and all of its sub keys are deleted.
Parameters
Return Value
hkey
IpszSubKey
Example
HKEY hkStdFileEditingi
if (RegOpenKey(HKEY CLASSES ROOT,
"NewAppDoc~ent\\pr-;;tocol\\StdFileEditing",
&hkStdFileEditing) == ERROR_SUCCESS) {
cb = sizeof(szBuff)i
if (RegQueryValue(hkStdFileEditing,
"handler" ,
szBuff,
&cb) == ERROR_SUCCESS
&& lstrcmpi("nwappobj.dll", szBuff) == 0)
RegDeleteKey (hkStdFileEditing, "handler") i
RegCloseKey(hkStdFileEditing);
See Also
422
RegCloseKey
RegEnumKey
RegEnumKey
Syntax
3.1
#include <shellapi.h>
LONG RegEnumKey(hkey, iSubkey, IpszBuffer, cbBuffer)
. function RegEnumKey(Key: HKey; index: Longint; buffer: PChar; cb:
Longint): Longint;
The RegEnumKey function enumerates the subkeys of a specified key.
Parameters
Return Value
Comments
hkey
iSubkey
IpszBuffer
cbBuffer
Chapter 4, Functions
423
RegOpenKey
Example
The following example uses the RegEnumKey function to put the values
associated with top-level keys into a list box:
HKEY hkRooti
char szBuff(80), szValue(80)i
static DWORD dwlndexi
LONG Cbi
if (RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hkRoot) == ERROR_SUCCESS)
for (dwlndex = OJ RegEnumKey(hkRoot, dwlndex, szBuff,
sizeof(szBuff)) == ERROR_SUCCESSi ++dwlndex) {
if (*szBuff == ' .')
continuei
cb = sizeof(szValue)j
if (RegQueryValue(hkRoot, (LPSTR) szBuff, szValue,
&cb) == ERROR_SUCCESS)
SendDlgltemMessage(hDlg, ID_ENUMLIST, LB_ADDSTRING, 0,
(LONG) (LPSTR) szValue)i
RegCloseKey(hkRoot)i
See Also
RegQueryValue
RegOpenKey
Syntax
3.1
#include <shellapi.h>
LONG RegOpenKey(hkey, IpszSubKey, IphkResult)
function RegOpenKey(Key: HKey; SubKey: PChar; var Result: HKey):
Longint;
The RegOpenKey function opens the specified key.
Parameters
Return Value
Comments
424
hkey
lpszSubKey
lphkResult
RegQueryValue
Example
"NewAppDoc~ent\\pr;-tocol\\StdFileEditing",
&hkStdFileEditing) == ERROR_SUCCESS) {
cb = sizeof(szBuff)i
if (RegQueryValue(hkStdFileEditing,
"handler",
szBuff,
&cb) == ERROR_SUCCESS
&& lstrc:rrpi("nwappobj.dll", szBuff) == 0)
RegDeleteKey (hkStdFileEditing, "handler") i
RegCloseKey(hkStdFileEditing)i
See Also
RegCreateKey
RegQueryValue
Syntax
3.1
#include <shellapi.h>
LONG RegQueryValue(hkey, IpszSubKey, IpszValue, lpcb)
function RegQueryValue(Key: HKey; SubKey: PChar; Value: PChar; var
cb: Longint): Longint;
The RegQueryValue function retrieves the text string associated with a
specified key.
Parameters
hkey
IpszSubKey
IpszValue
Chapter 4, Functions
425
RegSetValue
lpcb
Return Value
Example
"NewAppDoc~ent\\pr~tocol\\StdFileEditing",
&hkStdFileEditing)
cb
==
ERROR_SUCCESS) {
sizeof(szBuff);
if (RegQueryValue(hkStdFileEditing,
"handler" ,
szBuff,
&cb) == ERRO~SUCCESS
&& lstrcrnpi ("nwappobj .dll", szBuff) == 0)
RegDeleteKey(hkStdFileEditing, "handler");
RegCloseKey(hkStdFileEditing);
See Also
RegEnumKey
RegSetValue
Syntax
3.1
#include <shellapi.h>
LONG RegSetValue{hkey, IpszSubKey, fdwType, IpszValue, cb)
function RegSetValue{Key: HKey; SubKey: PChar; ValType: Longint;
Value: PChar; cb: Longint): Longint;
The RegSetValue function associates a text string with a specified key.
Parameters
426
hkey
ReplaceText
IpszSubKey
fdwType
IpszValue
cb
Return Value
Comments
If the key specified by the IpszSubKey parameter does not exist, the
RegSetValue function creates it.
Example
See Also
/* root
/* string for filename extension
/* required
RegSetValue(HKEY_CLASSES_ROOT,
"NewAppDocurnent",
REG_SZ,
"New Application",
15);
/* root
*/
/* string for class-definition key */
/* required
*/
*/
*/
*/
*/
RegCreateKey, RegQueryValue
ReploceText
Syntax
*/
*/
*/
3.1
#include <commdlg.h>
HWND ReplaceTextOpfr)
function ReplaceText(var FindReplace: TFindReplace): HWnd;
The ReplaceText function creates a system-defined modeless dialog box
that makes it possible for the user to find and replace text within a
document. The application must perform the actual find and replace
operations.
Chapter 4, Functions
427
ReplaceText
Parameters
lplr
Return Value
Errors
The return value is the window handle of the dialog box, or it is NULL if
an error occurs. An application can use this handle to communicate with
or to close the dialog box.
Use the CommDlgExtendedError function to retrieve the error value,
which may be one of the following:
CDERR_FINDRESFAILURE
CDERR_INITIALIZATION
CDERR_LOADRESFAILURE
CDERR_LOADSTRFAILURE
CDERR_LOCKRESFAILURE
CDERR_MEMALLOCFAILURE
CDERR_MEMLOCKFAILURE
CDERR_NOHINSTANCE
CDERR_NOHOOK
CDERR_NOTEMPLATE
CDERR_STRUCTSIZE
FRERR_BUFFERLENGTHZERO
428
ReplaceText
Comments
The dialog box procedure for the ReplaceText function passes user
requests to the application through special messages. The IParam
parameter of each of these messages contains a pointer to a
FINDREPLACE structure. The procedure sends the messages to the
window identified by the hwndOwner member of the FINDREPLACE
structure. An application can register the identifier for these messages by
specifying the commdlg_FindReplace string in a call to the
RegisterWindowMessage function.
For the TAB key to function correctly, any application that calls the
ReplaceText function must also call the IsDialogMessage function in its
main message loop. (The IsDialogMessage function returns a value that
indicates whether messages are intended for the Replace dialog box.)
Example
/* string to find
*/
/* string to replace */
Chapter 4, Functions
429
ResetDC
ResetDC
Syntax
3.1
#inc1 ude <print.h>
HDC ResetDC(hdc, lpdm)
function ResetDC(aHdc: HDC; DevMode: PDevMode): HDC;
The ResetDC function updates the given device context, based on the
information in the specified DEVMODE structure.
Parameters
hdc
Ipdm
Return Value
The return value is the handle of the original device context if the function
is successful. Otherwise, it is NULL.
Comments
430
ScaleViewportExtEx
device name, the application must delete the original device context and
create a new device context with the new information.
Before calling ResetDC, the application must ensure that all objects (other
than stock objects) that had been selected into the device context have
been selected out.
See Also
3.1
ScaleViewportExtEx
Syntax
Return Value
Chapter 4, Functions
hdc
nXnum
nXdenom
nYnum
nYdenom
IpSize
431
ScoleWindowExtEx
ScaleWindowExtEx
Syntax
3.1
*
*
Xnum)
Ynum)
I
I
Xdenom
Ydenom
Return Value
hdc
nXnum
nXdenom
nYnum
nYdenom
IpSize
ScrollWindowEx
Syntax
3.1
432
ScroliWindowEx
Parameters
hwnd
dx
dy
IprcScroll
/* rc */
IprcClip
hrgnUpdate
IprcUpdate
fuScroll
Meaning
Chapter 4, Functions
433
ScroliWindowEx
Return Value
Comments
Value
Meaning
SW_SCROLLCHILDREN
does not invalidate the area that is scrolled away from. If either of these
flags is set, scroliWindowEx invalidates this area. The area is not updated
until the application calls the UpdateWindow function, calls the
RedrawWindow function (specifying ROW _UPOATENOW or
ROW_ERASENOW), or retrieves the WM_PAINT message from the
application queue.
If the window has the WS_CLIPCHILOREN style, the returned areas
specified by hrgnUpdate and IprcUpdate represent the total area of the
scrolled window that must be updated, including any areas in child
windows that need qupdating.
If the SW_SCROLLCHILOREN flag is specified, Windows will not
properly update the screen if part of a child window is scrolled. The part
of the scrolled child window that lies outside the source rectangle will not
be erased and will not be redrawn properly in its new destination. Use the
DeferWindowPos function to move child windows that do not lie
completely within the IprcScroll rectangle.
434
SetAbortProc
3.1
SendDriverMessage
LRESULT SendDriverMessage(hdrvr, msg, IParaml,IParam2)
Syntax
hdrvr
msg
Return Value
See Also
IParaml
IParam2
SetAbortProc
Syntax
3.1
int SetAbortProc(hdc, abrtprc)
function SetAbortProc(DC: HDC; AbortProc: TAbortProc): Integer;
The SetAbortProc function sets the application-defined procedure that
allows a print job to be canceled during spooling. This function replaces
the SETABORTPROC printer escape for Windows version 3.1.
Chapter 4, Functions
435
SetBitmapDimensionEx
Parameters
Return Value
See Also
hdc
abrtprc
3.'
SetBitmapDimensionEx
Syntax
Parameters
hbm
nX
nY
IpSize
Return Value
436
SetBoundsRect
SetBoundsRect
Syntax
3.1
Parameters
hdc
IprcBounds
int
int
int
int
/* rc */
left;
top;
right;
bottom;
RECT;
flags
DCB_ACCUMULATE
Meaning
DCB_DISABLE
DCB_ENABLE
DCB_RESET
DCB_SET
Return Value
Chapter 4, Functions
The return value is the current state of the bounding rectangle, if the
function is successful. Like the flags parameter, the return value can be a
combination of DCB_ values.
437
SetMetoFileBitsBeHer
Comments
See Also
GetBoundsRect
SetMetaFileBitsBetter
Syntax
3.'
HGLOBAL SetMetaFileBitsBetter(hmf)
function SetMetaFileBitsBetter(mf: THandle): THandle;
The SetMetaFileBitsBetter function creates a memory metafile from the
data in the specified global-memory object.
Parameters
Return Value
Comments
hmf
See Also
438
GetMetaFileBits, SetMetaFileBits
SetViewportExtEx
3.1
SetSelectorBase
Syntax
Parameters
Return Value
See Also
selector
dwBase
The return value is the new selector value, if the function is successful.
GetSelectorBase, GetSelectorLimit, SetSelectorLimit
3.1
SetSelectorLimit
Syntax
Parameters
Return Value
See Also
selector
dwBase
SetViewportExtEx
Syntax
3.1
Parameters
Chapter 4, Functions
hdc
439
SefViewportOrgEx
nX
nY
IpSize
Return Value
Comments
See Also
SetWindowExtEx
3.1
SetViewportOrgEx
Syntax
Parameters
440
hdc
nX
SetViewporfOrgEx
nY
IpPoint
/* pt */
int x;
int y;
POINT;
Return Value
See Also
Chapter 4, Functions
441
SefWinDebuglnfo
SetWinDebuglnfo
Syntax
3.1
BOOL SetWinDebugInfoOpwd)
function SetWinDebugInfo(DebugInfo: PWinDebugInfo): Bool;
The SetWinDebuglnfo function sets current system-debugging
information for the debugging version of the Windows 3.1 operating
system.
Parameters
Ipwdi
Return Value
Comments
See Also
442
GetWinDebuglnfo
SetWindowExtEx
SetWindowExtEx
3.1
Syntax
hdc
nX
nY
IpSize
int
int
} SIZEi
Return Value
Comments
eXi
eYi
See Also
Chapter 4, Functions
SetViewportExtEx
443
SefWindowOrgEx
3.1
SetWindowOrgEx
Syntax
Parameters
hdc
nX
nY
lpPoint
Return Value
See Also
/* pt */
3.1
SetWindowPlacement
Syntax
Parameters
444
hwnd
SetWindowsHookEx
lpwndpl
Return Value
See Also
/* wndpl */
3.1
SetWindowsHookEx
Syntax
Parameters
Chapter 4, Functions
idHook
Meaning
WH_CALLWNDPROC
Installs a window-procedure
filter. For more information, see
the description of the
CallWndProc callback function.
Installs a computer-based training
(CBT) filter. For more
information, see the description
of the CBTProc callback function.
Installs a debugging filter. For
more information, see the
description of the DebugProc
callback function.
445
SetWindowsHookEx
Value
Meaning
WH_GETMESSAGE
WH_HARDWARE
WH-10URNALPLAYBACK
WH-10URNALRECORD
WH_KEYBOARD
WH_MOUSE
WH_MSGFILTER
WH_SYSMSGFILTER
446
hkprc
hinst
htask
SetWindowsHookEx
Return Value
Comments
i f ( ... )
Scope
WH_CALLWNDPROC
WH_CBT
WH_DEBUG
WH_GETMESSAGE
WH_HARDWARE
WH--10URNALRECORD
WH--10URNALPLAYBACK
WH_KEYBOARD
WH_MOUSE
WH_MSGFILTER
WH_SYSMSGFILTER
Task or system
Task or system
Task or system
Task or system
Task or system
System only
System only
Task or system
Task or system
Task or system
System only
For a given hook type, task hooks are called first, then system hooks.
Chapter 4, Functions
447
Shell Execute
ShellExecute
Syntax
3.1
#include <shellapi.h>
HINSTANCE ShellExecute(hwnd, IpszOp, IpszFile, IpszParams, IpszDir,
fsShowCmd)
function ShellExecute(hWnd: HWnd; Operation, FileName, Parameters,
Directory: PChar; ShowCmd: Integer): THandle;
The Shell Execute function opens or prints the specified file.
448
Shell Execute
Parameters
hwnd
IpszOp
IpszFile
IpszParams
IpszDir
fsShowCmd
Meaning
SW_HIDE
SW_SHOW
SW_SHOWMINIMIZED
SW_SHOWMINNOACTIVE
Chapter 4, Functions
449
Shell Execute
Value
SW_SHOWNOACTIVATE
Return Value
Errors
The return value is the instance handle of the application that was opened
or printed, if the function is successful. (This handle could also be the
handle of a DDE server application.) A return value less than or equal to
32 specifies an error. The possible error values are listed in the following
Comments section.
The Shell Execute function returns the value 31 if there is no association
for the specified file type or if there is no association for the specified
action within the file type. The other possible error values are as follows:
Value
o
2
3
5
6
8
10
11
12
13
14
15
450
Meaning
Meaning
ShellProc
Value
Meaning
16
19
20
21
Comments
See Also
ShellProc
Syntax
3.1
LRESULT CALLBACK ShellProc(code, wParam, IParam)
The ShellProc function is a library-defined callback function that a shell
application can use to receive useful notifications from the system.
Parameters
code
Value
Meaning
HSHELL_ACTIVATESHELLWINDOW
HSHELL_WINDOWCREATED
HSHELL_WINDOWDESTROYED
wParam
Chapter 4, Functions
451
Spool File
code
wParam
HSHELL_ACTIVATESHELLWINDOW
HSHELL_WINDOWCREATED
Not used.
Specifies the handle of the window
being created.
Specifies the handle of the window
being destroyed.
HSHELL_WINDOWDESTROYED
IParam
Return Value
Comments
SpoolFile
Syntax
3.1
HANDLE SpoolFileOpszPrinter,lpszPort,lpszJob,lpszFile)
function SpoolFile(Printer, Port, Job, F: PChar): THandle;
The Spool File function puts a file into the spooler queue. This function is
typically used by device drivers.
Parameters
452
IpszPrinter
IpszPort
IpszJob
IpszFile
StackTraceCSI PFirst
Return Value
The return value is the global handle that is passed to the spooler, if the
function is successful. Otherwise, it is an error value, which can be one of
the following:
SP_APP ABORT
SP_ERROR
SP_NOTREPORTED
SP_OUTOFDISK
SP_OUTOFMEMORY
SP_USERABORT
Comments
Applications should ensure that the spooler is enabled before calling the
Spool File function.
3.1
StackTraceCSI PFirst
Syntax
#include <toolhelp.h>
BOOL StackTraceCSIPFirst(lpste, wSS, wCS, wIP, wBP)
function StackTraceCSIPFirst(lpStackTrace: PStackTraceEntry; wSS, wCS,
wIP, wBP: Word): Bool;
The StackTraceCSIPFirst function fills the specified structure with
information that describes the specified stack frame.
Parameters
lpste
wSS
Chapter 4, Functions
1* ste *1
453
StackTraceFirst
Return Value
Comments
wes
wlP
wBP
See Also
StackTraceNext, StackTraceFirst
StackTraceFirst
Syntax
3.1
#include <toolhelp.h>
BOOL StackTraceFirst{lpste, htask)
function StackTraceFirst{lpStrackTrace: PStackTraceEntry; hTask:
THandle): Bool;
The StackTraceFirst function fills the specified structure with information
that describes the first stack frame for the given task.
Parameters
lpste
454
/* ste */
StackTraceNext
WORD
wBPi
WORD
WCSi
WORD
wIPi
HMODULE hModulei
WORD
wSegmentj
WORD
wFlagsj
STACKTRACEENTRYj
htask
Return Value
Comments
See Also
StackTraceCSIPFirst, StackTraceNext
StackTraceNext
Syntax
3.1
#include <toolhelp.h>
BOOL StackTraceNext(lpste)
function StackTraceNext(lpStackTrace: PStackTraceEntry): Bool;
The StackTraceNext function fills the specified structure with information
that describes the next stack frame in a stack trace.
Parameters
Ipste
Chapter 4, Functions
/* ste */
455
StartDoc
WORD
wSSj
WORD
wBPj
WORD
wCSj
WORD
wIPj
HMODULE hModulej
WORD
wSegmenti
WORD
wFlagsj
STACKTRACEENTRYi
Return Value
Comments
See Also
StartDoc
Syntax
3.1
int StartDoc(hdc, lpdi)
function StartDoc(DC: HDC; var di: TDocInfo): Integer;
The StartDoc function starts a print job. For Windows version 3.1, this
function replaces the STARTDOC printer escape.
Parameters
hdc
Ipdi
Return Value
Comments
See Also
456
SubtractRect
3.1
StartPage
Syntax
int StartPage(hdc)
function StartPage(DC: HDC): Integer;
The StartPage function prepares the printer driver to accept data.
Parameters
hdc
Return Value
The return value is greater than zero if the function is successful. It is less
than or equal to zero if an error occurs.
Comments
The system disables the ResetDC function between calls to the StartPage
and EndPage functions. This means that applications cannot change the
device mode except at page boundaries.
See Also
3. 1
SubtractRect
Syntax
IprcDest
Parameters
Return Value
/* rc */
IprcSourcel
IprcSource2
Chapter 4, Functions
457
SysMsgProc
Comments
See Also
SysMsgProc
Syntax
3.1
LRESULT CALLBACK SysMsgProc(code, wParam, IParam)
The SysMsgProc function is a library-defined callback function that the
system calls after a dialog box, message box, or menu has retrieved a
message, but before the message is processed. The callback function can
process or modify messages for any application in the system.
Parameters
code
Meaning
MSGF_DIALOGBOX
MSGF_MENU
Must be NULL.
lParam
458
/* msg */
SystemHeaplnfo
POINT
ptj
MSGj
Return Value
Comments
The return value should be nonzero if the function processes the message.
Otherwise, it should be zero.
This callback function must be in a dynamic-link library (DLL).
An application must install this callback function by specifying the
WH_SYSMSGFILTER filter type and the procedure-instance address of
the callback function in a call to the SetWindowsHookEx function.
SysMsgProc is a placeholder for the library-defined function name. The
actual name must be exported by including it in an EXPORTS statement
in the library's module-definition file.
See Also
SystemHeaplnfo
Syntax
3.1
#include <toolhelp.h>
BOOL SystemHeapInfoOpshi)
function SystemHeapInfoOpSysHeap: PSysHeapInfo): Bool;
The SystemHeaplnfo function fills the specified structure with
information that describes the USER.EXE and GDI.EXE heaps.
Parameters
lpshi
Return Value
Comments
Chapter 4, Functions
/* shi */
459
SystemParameterslnfo
3.1
Parameters
uAction
Value
Meaning
SPCGETBEEP
SPCGETBORDER
SPCGETFASTTASKSWITCH
SPCGETGRIDGRANULARITY
SPCGETICONTITLELOGFONT
SPCGETICONTITLEWRAP
SPCGETKEYBOARDDELAY
SPCGETKEYBOARDSPEED
SPCGETMENUDROPALIGNMENT
SPCGETMOUSE
SPCGETSCREENSAVEACTIVE
SPCGETSCREENSAVETIMEOUT
SPCICONHORIZONTALSPACING
SPCICONVERTICALSPACING
460
SystemParameterslnfo
Value
Meaning
SPCLANGDRIVER
SPCSETBEEP
SPCSETBORDER
SPI_SETDESKPATTERN
SPI_SETDESKWALLPAPER
SPI_SETDOUBLECLKHEIGHT
SPI_SETDOUBLECLICKTIME
SPI_SETDOUBLECLKWIDTH
SPI_SETFASTTASKSWITCH
SPI_SETGRIDGRANULARITY
SPI_SETICONTITLELOGFONT
SPI_SETICONTITLEWRAP
SPCSETKEYBOARDDELAY
SPCSETKEYBOARDSPEED
SPCSETMENUDROPALIGNMENT
SPCSETMOUSE
SPCSETMOUSEBUTTONSWAP
SPI_SETSCREENSAVEACTNE
SPCSETSCREENSAVETIMEOUT
Chapter 4, Functions
461
SystemParameterslnfo
uParam
IpvParam
fuWinlni
Value
Meaning
SPIF_UPDATEINIFILE
SPIF_SENDWININICHANGE
Return Value
Comments
Constant
uParam
IpvParam
SPCGETBEEP
SPCGETBORDER
SPCGETFASTTASKSWITCH
SPCGETGRIDGRANULARITY
SPCGETICONTITLELOGFONT
SPCGETICONTITLEWRAP
462
SystemParameterslnfo
Constant
uParam
IpvParam
SPCGETKEYBOARDDELAY
SPCGETKEYBOARDSPEED
SPCGETMENUDROPALIGNMENT
SPCGETMOUSE
SPCGETSCREENSAVEACTIVE
SPCGETSCREENSAVETIMEOUT
SPCICONHORIZONTALSPACING
SPCICONVERTICALSPACING
SPCLANGDRIVER
SPCSETBEEP
SPCSETBORDER
Chapter 4, Functions
Is NULL.
463
SystemParameterslnfo
Constant
uParam
IpvParam
SPCSETDESKPATTERN
Oor-l
SPCSETDESKWALLPAPER
SPCSETDOUBLECLKHEIGHT
Double-click height,
in pixels
Is NULL.
Double-click time,
in milliseconds
Double-click width,
Is NULL.
in pixels
TRUE = turn on fast task Is NULL.
switching; FALSE =turn
it off
Grid granularity,
Size of the LOG FONT
Points to a LOGFONT structure that
structure
defines the font to use for icon titles. If
uParam is set to zero and IParam is set
to NULL, Windows uses the icon-title
font and spacings that were in effect
when Windows was started.
Is NULL.
TRUE =turn wrapping on; FALSE =
turn wrapping off
Is NULL.
Keyboard-delay
setting
Is NULL.
Repeat-speed setting
Is NULL.
TRUE = rightalignment; FALSE =
left-alignment
o
Points to an integer array named
IpiMouse, where IpiMouse[O] receives
the WIN.INI entry xMouseThreshold,
IpiMouse[1] receives the entry
yMouseThreshold, and IpiMouse[2]
receives the entry MouseSpeed.
SPCSETDOUBLECLICKTIME
SPCSETDOUBLECLKWIDTH
SPCSETFASTTASKSWITCH
SPI_SETGRIDGRANULARITY
SPCSETICONTITLELOGFONT
SPCSETICONTITLEWRAP
SPI_SETKEYBOARDDELAY
SPCSETKEYBOARDSPEED
SPCSETMENUDROPALIGNMENT
SPCSETMOUSE
464
SystemParameterslnfo
Constant
uParam
IpvParam
SPI_SETMOUSEBUTTONSWAP
Is NULL.
SPCSETSCREENSAVEACTIVE
SPCSETSCREENSAVETIMEOUT
Example
Is NULL.
Is NULL.
return FALSE;
casEWM COMMAND:
switch (wParam)
case lOOK:
/* Set double-click time to a user-specified value. */
SendDlgltemMessage(hdlg, IDD~CLKTlME, WM_GETTEXT,
sizeof(szBuf), (DWORD) (LPSTR) szBuf);
SystemParameterslnfo(SPI_SETDOUBLECLICKTlME, atoi(szBuf),
(LPVOID) NULL, SPIF_UPDATEINIFlLE I
SPIF_SENDWININICHANGE);
Chapter 4, Functions
465
TaskFindHandle
EndDialog(hdlg, TRUE);
return TRUE;
TaskFindHandle
Syntax
3.1
#inc1ude <toolhelp.h>
BaaL TaskFindHandleOpte, htask)
function TaskFindHandleOpTask: PTaskEntry; hTask: THandle): Bool;
The TaskFindHandle function fills the specified structure with
information that describes the given task.
Parameters
[pte
htask
Return Value
Comments
466
ToskFirst
TaskFirst, TaskNext
TaskFirst
31
I
#include <toolhelp.h>
BaaL TaskFirstOpte)
Syntax
[pte
Return Value
Comments
The TaskFirst function can be used to begin a walk through the task
queue. An application can examine subsequent entries in the task queue
by using the TaskNext function.
Chapter 4, Functions
467
TaskGetCSIP
TaskFindHandle, TaskNext
TaskGetCSIP
Syntax
3.1
#include <toolhelp.h>
DWORD TaskGetCSIP(htask)
function TaskGetCSIP(hTask: THandle): Longint;
The TaskGetCSIP function returns the next CS:IP value of a sleeping task.
This function is useful for applications that must "know" where a
sleeping task will begin execution upon awakening.
Parameters
htask
Return Value
Comments
See Also
The return value is the next CS:IP value, if the function is successful. If the
htask parameter is invalid, the return value is NULL.
TaskGetCSIP should not be called if htask identifies the current task.
DirectedYield, TaskSetCSIP, TaskSwitch
TaskNext
Syntax
3.1
#include <toolhelp.h>
BaaL TaskNext(lpte)
function TaskNext(lpTask: PTaskEntry): Bool;
The TaskNext function fills the specified structure with information about
the next task on the task queue.
Parameters
468
lpte
TaskSetCSIP
#include <toolhelp.h>
typedef struct tagTASKENTRY { /* te */
DWORD
dwSize;
HTASK
hTask;
HTASK
hTaskParent;
HINSTANCE hlnst;
HMODULE
hModule;
WORD
wSS;
WORD
wSP;
WORD
wStackTop;
WORD
wStackMinimum;
WORD
wStackBottom;
WORD
wcEvents;
HGLOBAL
hQueue;
char
szModule[MAX_MODULE_NAME + 1] ;
WORD
wPSPOffset;
HANDLE
hNext;
TASKENTRY;
Return Value
Comments
The TaskNext function can be used to continue a walk through the task
queue. The walk must have been started by the TaskFirst or
TaskFindHandle function.
See Also
TaskFindHandle, TaskFirst
TaskSetCSIP
Syntax
3.1
#include <toolhelp.h>
DWORD TaskSetCSIP(htask, wCS, wIP)
function TaskSetCSIP(hTask: THandle; wCS, wIP: Word): Longint;
The TaskSetCSIP function sets the CS:IP value of a sleeping task. When
the task is yielded to, it will begin execution at the specified address.
Parameters
Return Value
Chapter 4, Functions
htask
wCS
wIP
The return value is the previous CS:IP value for the task. The TaskSwitch
function uses this value. The return value is NULL if the htask parameter
is invalid.
469
TaskSwitch
Comments
See Also
TaskSwitch
Syntax
3.1
#inc1ude <toolhelp.h>
BaaL TaskSwitch(htask, dwNewCSIP)
function TaskSwitch(hTask: THandle; dwNewCSIP: Longint): Bool;
The TaskSwitch function switches to the given task. The task begins
executing at the specified address.
Parameters
Return Value
Comments
htask
dwNewCSIP
See Also
TerminateApp
Syntax
3.1
#inc1ude <toolhelp.h>
void TerminateApp(htask, wFlags)
procedure TerminateApp(hTask: THandle; wFlags: Word);
The TerminateApp function ends the given application instance (task).
Parameters
470
htask
TimerCount
wFlags
Meaning
Comments
This function returns only if htask is not NULL and does not identify the
current task.
The TerminateApp function unregisters all callback functions registered
with the Tool Help functions and then ends the application as if the given
task had produced a general-protection (GP) fault or other error.
TerminateApp should be used only by debugging applications, because
the function may not free not all objects owned by the ended application.
See Also
TimerCount
Syntax
3.1
#include <toolhelp.h>
BOOL TimerCount(lpti)
function TimerCount(lpTimer: PTimerInfo): Bool;
The TimerCount function fills the specified structure with the execution
times of the current task and VM (virtual machine).
Parameters
Ipti
Chapter 4, Functions
/* ti */
471
TimerProc
DWORD dwmsThisVM;
TIMERINFO;
Return Value
Comments
See Also
GetTickCount
TimerProc
Syntax
2.x
void CALLBACK TimerProdhwnd, msg, idTimer, dwTime)
The TimerProc function is an application-defined callback function that
processes WM_TIMER messages.
Parameters
Return Value
Comments
See Also
472
hwnd
msg
idTimer
dwTime
UnAllocFileHandles
3.1
UnAllocDiskSpace
Syntax
#inc1ude <stress.h>
void U nAllocDiskSpace(drive)
procedure UnAllocDiskSpace(wDrive: Word);
The UnAllocDiskSpace function deletes the STRESS.EAT file from the
root directory of the specified drive. This frees the disk space previously
consumed by the AllocDiskSpace function.
Parameters
Return Value
See Also
drive
Meaning
EDS_WlN
EDS_CUR
EDS_TEMP
UnAllocFileHandles
Syntax
3.1
#inc1ude <stress.h>
void U nAllocFileHandles( void)
procedure UnAllocFileHandles;
The UnAllocFileHandles function frees all file handles allocated by the
AllocFileHandles function.
Parameters
Return Value
See Also
Chapter 4, Functions
473
UndelefeFile
UndeleteFile
Syntax
#inc1ude <wfext.h>
int FAR PASCAL UndeleteFile(hwndParent, IpszDir)
TFM_UnDelete_Proc = function(Handle: HWnd; P: PChar): Longint;
The UndeleteFile function is an application-defined callback function that
File Manager calls when the user chooses the Undelete command from
the File Manager File menu.
Parameters
Return Value
hwndParent
IpszDir
Meaning
-I
IDOK
IDCANCEL
An error occurred.
A file was undeleted. File Manager will repaint its windows.
No file was undeleted.
UnhookWindowsHookEx
Syntax
3.1
BOOL UnhookWindowsHookEx(hhook)
function UnhookWindowsHookEx(Hook: HHook): Bool;
The UnhookWindowsHookEx function removes an application-defined
hook function from a chain of hook functions. A hook function processes
events before they are sent to an application's message loop in the
WinMain function.
Parameters
Return Value
474
hhook
VerFindFile
Comments
Example
See Also
CallNextHookEx, SetWindowsHookEx
VerFindFile
Syntax
3.1
#include <ver.h>
DINT VerFindFile(flags, IpszFilename, IpszWinDir, IpszAppDir,
IpszCurDir, IpuCurDirLen, IpszDestDir, IpuDestDirLen)
function VerFindFile(Flags: Word; FileName, WinDir, AppDir, CurDir:
PChar; var CurDirLen: Word; DestDir: PChar; var DestDirLen: Word):
Word;
The VerFindFile function determines where to install a file based on
whether it locates another version of the file in the system. The values
VerFindFile returns are used in a subsequent call to the VerlnstallFile
function.
Parameters
flags
Chapter 4, Functions
475
VerFindFile
lpszFilename
lpsz WinDir
lpszAppDir
lpszCurDir
476
VerFindFile
Return Value
The return value is a bitmask that indicates the status of the file, if the
function is successful. This value may be one or more of the following:
Error
Meaning
VFF_CURNEDEST
VFF_BUFFfOOSMALL
VerlnstallFile
Chapter 4, Functions
477
VerlnstallFile
VerlnstallFile
Syntax
3.1
#include <ver.h>
DWORD VerlnstallFile(flags,lpszSrcFilename, IpszDestFilename,
IpszSrcDir, IpszDestDir, IpszCurDir, IpszTmpFile, IpwTmpFileLen)
function VerInstallFile(Flags: Word; SrcFileNarne, DestFileNarne, SrcDir,
DestDir, CurDir, TmpFile: PChar; var TmpFileLen: Word): Longint;
The VerlnstallFile function attempts to install a file based on information
returned from the VerFindFile function. VerlnstallFile decompresses the
file with the LZCopy function and checks for errors, such as outdated files.
Parameters
flags
Meaning
VIFF_FORCEINSTALL
VIFF_DONTDELETEOLD
478
VerlnstallFile
Chapter 4, Functions
IpszSrcFilename
IpszDestFilename
IpszSrcDir
IpszDestDir
IpszCurDir
IpszTmpFile
IpwTmpFileLen
479
VerlnstallFile
VIF_DIFFCODEPG
VIF_ACCESSVIOLATION
480
Meaning
VerlnstallFile
Value
Meaning
VIF_SHARINGVIOLATION
VIF_CANNOTCREATE
VIF_CANNOTDELETE
VIF_CANNOTRENAME
VIF_OUTOFMEMORY
VIF_CANNOTREADSRC
VIF_CANNOTREADDST
VIF_BUFFfOOSMALL
Chapter 4, Functions
481
VerLanguageName
VerFindFile
VerLanguageName
Syntax
3.1
#include <ver.h>
UINT VerLanguageName(uLang, IpszLang, cbLang)
function VerLanguageName(Lang:Word; Lang: PChar; Size: Word): Word;
The VerLanguageName function converts the specified binary Microsoft
language identifier into a text representation of the language.
Parameters
482
uLang
IpszLang
VerLanguageName
cbLang
IpszLang.
Return Value
Comments
The return value is the length of the string that represents the language
identifier, if the function is successful. This value does not include the null
character at the end of the string. If this value is greater than cbLang, the
string was truncated to cbLang. The return value is zero if an error occurs.
Unknown uLang values do not produce errors.
Typically, an installation application uses this function to translate a
language identifier returned by the VerQueryValue function. The text
string may be used in a dialog box that asks the user how to proceed in
the event of a language conflict.
Windows supports the following lan'guage identifiers:
Value
Language
Ox0401
Ox0402
Ox0403
Ox0404
Ox0405
Ox0406
Ox0407
Ox0408
Ox0409
Ox040A
Ox040B
Ox04OC
Ox040D
Ox040E
Ox040F
Ox0410
Ox0411
Ox0412
Ox0413
Ox0414
Ox0415
Ox0416
Ox0417
Ox0418
Ox0419
Ox041A
Arabic
Bulgarian
Catalan
Traditional Chinese
Czech
Danish
German
Greek
U.S. English,
Castilian Spanish
Finnish
French
Hebrew
Hungarian
Icelandic
Italian
Japanese
Korean
Dutch
Norwegian - Bokmal
Polish
Brazilian Portuguese
Rhaeto-Romanic
Romanian
Russian
Croato-Serbian (Latin)
Chapter 4, Functions
483
VerQueryValue
Value
Language
Ox041B
Ox041C
Ox041D
Ox041E
Ox041F
Ox0420
Ox0421
Ox0804
Ox0807
Ox0809
Ox080A
Ox08OC
Ox081O
Ox0813
Ox0814
Ox0816
Ox081A
OxOCOC
Oxl0OC
Slovak
Albanian
Swedish
Thai
Turkish
Urdu
Bahasa
Simplified Chinese
Swiss German
U.K. English
Mexican Spanish
Belgian French
Swiss Italian
Belgian Dutch
Norwegian - Nynorsk
Portuguese
Serbo-Croatian (Cyrillic)
Canadian French
Swiss French
3.1
VerQueryValue
Syntax
#include <ver.h>
BOOL VerQueryValueOpvBlock, IpszSubBlock, IplpBuffer, lpcb)
function VerQueryValue(Block: Pointer; SubBlock: PChar; var Buffer:
Pointer; var Len: Word): Bool;
The VerQueryValue function returns selected version information from
the specified version-information resource. To obtain the appropriate
resource, the GetFileVersionlnfo function must be called before
VerQueryValue.
Parameters
484
IpvBlock
IpszSubBlock
VerQueryValue
Description
Form
\ VarFilelnfo\Translation
\StringFilelnfo\lang-charset \string-name
lplpBuffer
lpcb
Return Value
The return value is nonzero if the specified block exists and version
information is available. If lpcb is zero, no value is available for the
specified version-information name. The return value is zero if the
specified name does not exist or the resource pointed to by lpvBlock is not
valid.
Comments
Value
Comments
CompanyName
Chapter 4, Functions
485
VerQueryValue
Name
Value
File Description
FileVersion
Internal Name
LegalCopyright
LegalTrademarks
OriginalFilenarne
PrivateBuild
ProductName
ProductVersion
Special Build
486
WindowProc
Example
abData[512]i
handle i
dwSizei
lpBuffer i
szName[512]i
dwSize
See Also
GetFileVersionlnfo
2.x
WindowProc
Syntax
Parameters
Return Value
Comments
hwnd
msg
wParam
IParam
The return value is the result of the message processing. The value
depends on the message being processed.
The WindowProc name is a placeholder for the application-defined
function name. The actual name must be exported by including it in an
EXPORTS statement in the application's module-definition file.
See Also
Chapter 4, Functions
DefWindowProc, RegisterClass
487
WNetAddConnection
3.1
WNetAddConnection
Syntax
Parameters
IpszNetPath
IpszPassword
See Also
488
Meaning
WN_SUCCESS
WN_NOT_SUPPORTED
WN_OUT_OF_MEMORY
WN_NET_ERROR
WN_BAD_POINTER
WN_BAD_NETNAME
WN_BAD_LOCALNAME
WN_BAD_PASSWORD
WN_ACCESS_DENIED
WN_ALREADY_CONNECTED
WNetCancelConnection, WNetGetConnection
WNetGetConnection
WNetCancelConnection
Syntax
3.1
Parameters
Return Value
IpszName
fForce
Meaning
WN_SUCCESS
WN_NOT_SUPPORTED
WN_OUT_OF_MEMORY
WN_NET_ERROR
WN_BAD_POINTER
WN_BAD_VALUE
WN_NOT_CONNECTED
See Also
WNetAddConnection, WNetGetConnection
WNetGetConnection
Syntax
3.1
UINT WNetGetConnection(lpszLocalName,lpszRemoteName,
cbRemoteName)
function WNetGetConnection(lpszLocalName, IpszRemoteName: PChar;
cbBufferSize: PWord): Word;
Chapter 4, Functions
489
WordBreakProc
Return Value
See Also
IpszLocalName
IpszRemoteName
cbRemoteName
Meaning
WN_SUCCESS
WN_NOT_SUPPORTED
WN_OUT_OF_MEMORY
WN_NET_ERROR
WN_BAD_POINTER
WN_BAD_VALUE
WNetAddConnection, WNetCancelConnection
3.1
Word BreakProc
Syntax
Parameters
490
IpszEditText
WordBreakProc
ichCurrent Word
cbEditText
action
WB_ISDELIMITER
Return Value
Comments
Action
See Also
Chapter 4, Functions
Send Message
491
492
5
Data types
The data types in this chapter are keywords that define the size
and meaning of parameters and return values associated with
functions for the Microsoft Windows operating system, version
3.1. The following table contains character, integer, and Boolean
types; pointer types; and handles. The character, integer, and
Boolean types are common to most C compilers. Most of the
pointer-type names begin with a prefix of P, N (for near pointers),
or LP (for long pointers). A near pointer accesses data within the
current data segment, and a long pointer contains a 32-bit
segment:offset value. A Windows application uses a handle to
refer to a resource that has been loaded into memory. Windows
provides access to these resources through internally maintained
tables that contain individual entries for each handle. Each entry
in the handle table contains the address of the resource and a
means of identifying the resource type.
The Windows data types are defined in the following table:
Type
Definition
ABORTPROC
ATOM
BOOl
BYTE
493
Type
Definition
CATCHBUF[9]
COLORREF
DLGPROC
DWORD
FARPROC
FNCALLBACK
FONTENUMPROC
GLOBALHANDLE
GNOTIFYPROC
GOBJENUMPROC
GRAYSTRINGPROC
HANDLE
HCURSOR
HFILE
HGDIOBJ
HGLOBAL
HHOOK
HKEY
HLOCAL
HMODULE
HOBJECT
494
Type
Definition
HWND
HOOKPROC
HRSRC
LHCLIENTDOC
LHSERVER
LHSERVERDOC
LlNEDDAPROC
LOCALHANDLE
LONG
LPABC
LPARAM
LPBI
LPBITMAP
LPBITMAPCOREHEADER
LPBITMAPCOREINFO
LPBITMAPFILEHEADER
LPBITMAPINFO
495
Type
Definition
LPBITMAPINFOHEADER
LPCATCHBUF
LPCBT_ CREATEWND
LPCHOOSECOLOR
LPCHOOSEFONT
LPCLlENTCREATESTRUCT
LPCOMPAREITEMSTRUCT
LPCPLINFO
LPCREATESTRUCT
LPCSTR
LPCTLINFO
LPCTLSTVLE
LPDCB
LPDEBUGHOOKINFO
LPDELETEITEMSTRUCT
LPDEVMODE
LPDEVNAMES
LPDOCINFO
496
Type
Definition
LPDRAWITEMSTRUCT
LPDRIVERINFOSTRUCT
LPDRVCONFIGINFO
LPEVENTMSG
LPDRIVERINFOSTRUCT
LPFINDREPLACE
LPFMS_GETDRIVEINFO
LPFMS_GETFILESEL
LPFMS_LOAD
LPHANDLETABLE
LPHELPWININFO
LPINT
LPKERNINGPAIR
LPLOGBRUSH
497
Type
Definition
LPLOGFONT
LPLOGPALETTE
LPLOGPEN
LPLONG
LPMAT2
LPMDICREATESTRUCT
LPMEASUREITEMSTRUCT
LPMETAFILEPICT
LPMETARECORD
LPMOUSEHOOKSTRUCT
LPMSG
LPNCCALCSIZE_PARAMS
LPNEWCPLINFO
498
Type
Definition
LPNEWTEXTMETRIC
LPOFSTRUCT
LPOLECLIENT
LPOLECLlENTVTBL
LPOLEOBJECT
LPOLEOBJECTVTBL
LPOLESERVER
LPOLESERVERDOC
LPOLESERVERDOCVTBL
LPOLESERVERVTBL
LPOLESTREAM
LPOLESTREAMVTBL
LPOLETARGETDEVICE
LPOPENFILENAME
LPOUTLINETEXTMETRIC
LPPAINTSTRUCT
LPPALETTEENTRY
LPPOINT
LPPOINTFX
LPPRINTDLG
499
Type
Definition
LPRASTERIZER_STATUS
LPRECT
LPRGBQUAD
LPRGBTRIPLE
LPSEGINFO
LPSIZE
LPSTR
LPTEXTMETRIC
LPTTPOLYCURVE
LPTTPOLYGONHEADER
LPVOID
LPWINDOWPLACEMENT
LPWINDOWPOS
LPWNDCLASS
LPWORD
LRESULT
MFENUMPROC
500
Type
Definition
NEARPROC
OLECLIPFORMAT
PATTERN
PCONVCONTEXT
PCONVINFO
PHSZPAIR
PROPENUMPROC
RSRCHDLRPROC
TIMERPROC
UINT
WNDENUMPROC
WNDPROC
WORD
WPARAM
501
502
Messages
3.0
CB ADDSTRING
wParam = 0;
IParam = (LPARAM)
(LPCSTR) Ipsz;
Return Value
Comments
Ipsz
The return value is the zero-based index to the string in the list box. The
return value is CB_ERR if an error occurs; the return value is
CB_ERRSP ACE if insufficient space is available to store the new string.
If an owner-drawn combo box was created with the CBS_SORT style but
not the CBS_HASSTRINGS style, the WM_COMPAREITEM message is
sent one or more times to the owner of the combo box so that the new
item can be properly placed in the list box.
Chapter 6, Messages
503
CB_DELETESTRING
To insert a string into a specific location within the list, use the
CB_INSERTSTRING message.
Example
See Also
CB_INSERTSTRING, WM_COMPAREITEM
CB_DELETESTRING
3.0
CB DELETESTRING
wParam = (WPARAM) index;
lParam = OL;
/* item to delete
*/
/* not used, must be zero */
index
Return Value
The return value is a count of the strings remaining in the list. The return
value is CB_ERR if the index parameter specifies an index greater than the
number of items in the list.
Comments
If the combo box was created with an owner-drawn style but without the
CBS_HASSTRINGS style, a WM_DELETEITEM message is sent to the
owner of the combo box so that the application can free any additional
data associated with the item.
Example
See Also
504
WM_DELETEITEM
CB_GETDROPPEDCONTROLRECT
CB_FINDSTRINGEXACT
3.1
CB FINDSTRINGEXACT
wParam = (WPARAM) indexStart;
/* item before start of search */
lParam = (LPARAM) (LPCSTR) lpszFind; /* address of prefix string
*/
Return Value
Comments
See Also
indexStart
IpszFind
If the combo box was created with an owner-drawn style but without the
CBS_HASSTRINGEXS style, this message returns the index of the item
whose doubleword value matches the value of the IpszFind parameter.
CB_FINDSTRING, CB_SETCURSEL
CB_GETDROPPEDCONTROLRECT
CB GETDROPPEDCONTROLRECT
wParam = 0;
lParam = (LPARAM) (RECT FAR*) lprc;
3.1
/* not used, must be zero
*/
/* address of RECT structure */
Chapter 6, Messages
505
CB_GETDROPPEDSTATE
Parameters
[pre
Return Value
Example
/* rc */
({LPRECT) &rcl));
CB_GETDROPPEDSTATE
3.1
CB GETDROPPEDSTATE
wParam = 0;
/* not used, must be zero */
lParam = OL;
/* not used, must be zero */
Return Value
The return value is nonzero if the list box is visible; otherwise, it is zero.
Example
This example determines whether the list box of a combo box is visible:
BOOLfDropped;
fDropped = (BOOL) SendDlgltemMessage{hdlg, ID_MYCOMBOBOX,
CB_GETDROPPEDSTATE, 0, OL);
See Also
506
CB_SHOWDROPDOWN
CB_GETITEMHEIGHT
3.1
CB_GETEXTENDEDUI
CB GETEXTENDEDUI
wParam = 0;
1* not used, must be zero
lParam = aLi
1* not used, must be zero
*1
*1
Comments
Pressing the DOWN ARROW key displays the list box (F4 is disabled).
a Scrolling in the static control is disabled when the item list is not visible
(arrow keys are disabled).
Example
This example determines whether a combo box has the extended user
interface:
BOOLfExt ended i
fExtended=(BOOL)SendDlgltemMessage(hdlg,ID_MYCOMBOBOX,
CB_GETEXTENDEDUI, 0, OL);
See Also
CB_SETEXTENDEDUI
CB_GETITEMHEIGHT
CB GETITEMHEIGHT
wParam = (WPARAM) indeXi
lParam = aLi
3.1
1* item index
*/
1* not used, must be zero *1
Chapter 6, Messages
507
CB_SETEXTENDEDUI
Parameters
Return Value
Example
index
The return value is the height, in pixels, of the list items in a combo box.
The return value is the height of the item specified by the index parameter
if the combo box has the CBS_OWNERDRAWVARIABLE style. The
return value is the height of the edit-control (or static-text) portion of the
combo box if index is -1. The return value is CB_ERR if an error occurred.
This example sends a CB_GETITEMHEIGHT message to retrieve the
height of the list items in a combo box:
LRESULT lrHeight;
lrHeight = SendDlgltemMessage(hdlg, ID_MYCOMBOBOX,
CB_GETITEMHEIGHT, 0, OL);
See Also
CB_SETITEMHEIGHT
3.1
CB_SETEXTENDEDUI
CB SETEXTENDEDUI
wParam = (WPARAM) (BOOL) fExtended;
lParam = OL;
/* extended UI flag
*/
/* not used, must be zero */
Return Value
Comments
508
fExtended
CB_SETITEMHEIGHT
Example
II
Pressing the DOWN ARROW key displays the list box (F4 is disabled).
II
Scrolling in the static control is disabled when the item list is not visible
(the arrow keys are disabled).
This example selects the extended user interface for a combo box:
SendDlgltemMessage(hdl~D_MYCOMBOBO)GB_SETEXTENDEDUI,
TRUE,
See Also
OL);
CB_GETEXTENDEDUI
3.1
CB_SETITEMHEIGHT
CB SETITEMHEIGHT
wParam = (WPARAM) index;
/* item index */
lParam= (LPARAM) (int) height; /*itemheight*/
index
height
Return Value
Comments
Chapter 6, Messages
509
EM_GETPASSWORDCHAR
Example
See Also
CB_GETITEMHEIGHT
3.1
EM_GETFIRSNISIBLELINE
EM GETFIRSTVISIBLELINE
wParam = 0;
/* not used, must be zero */
lParam = OL;
/* not used, must be zero */
Example
The return value is the zero-based index of the topmost visible line. For
single-line edit controls, the return value is zero.
This example gets the index of the topmost visible line in an edit control:
int FirstVis;
FirstVis = (int) SendDlgItemMessage(hdlg, IDD_EDIT,
EM_GETFIRSTVISIBLELINE, 0, OL);
EM_GETPASSWORDCHAR
3.1
EM GETPASSWORDCHAR
wParam = 0;
/* not used, must be zero */
lParam = OL;
/* not used, must be zero */
510
EM_SETREADONLY
Return Value
Comments
EM_SETPASSWORDCHAR
EM_GETWORDBREAKPROC
3.1
EM GETWORDBREAKPROC
wParam = OJ
/* not used, must be zero */
lParam = OL;
/* not used, must be zero */
Comments
See Also
3.1
EM SETREADONLY
wParam = (WPARAM)
lParam = OL;
(BOOL) fReadOnly;
/* read-only flag
*/
/* not used, must be zero */
Chapter 6, Messages
511
EM_SETWORDBREAKPROC
Parameters
Return Value
Comments
Example
fReadOnly
EM_SElWORDBREAKPROC
3.1
EM SETWORDBREAKPROC
wParam = 0;
/* not used, must be zero */
lParam= (LPARAM) (EDITWORDBREAKPROC) ewbprc; /* address of function * /
Return Value
Comments
ewbprc
512
LB_FINDSTRINGEXACT
LB_FINDSTRINGEXACT
3.1
LB FINDSTRINGEXACT
wParam = (WPARAM) indexStart;
/* item before start of search */
lParam = (LPARAM) (LPCSTR) lpszFind; /* address of search string
*/
Return Value
Comments
indexStart
lpszFind
The return value is the index of the matching item, or it is LB_ERR if the
search was unsuccessful.
If the list box was created with an owner-drawn style but without the
Chapter 6, Messages
513
LB_SETCARETINDEX
LB_GETCARETINDEX
3.1
LB GETCARETINDEX
wParam = 0;
/* not used, must be zero */
lParam = OL;
/* not used, must be zero */
Example
See Also
LB_SETCARETINDEX
LB_SETCARETINDEX
3.1
LB SETCARETINDEX
/* item index
*/
wParam = (WPARAM) index;
lParam=MAKELPARAM(fScroll, 0); /* flag for scrolling item */
Return Value
514
index
fScroll
Example
See Also
LB_GETCARETINDEX
STM_GETICON
3. 1
STM GET ICON
wParam = Oi
lParam = aLi
Example
See Also
STM_SETICON
STM SETICON
wParam = (WPARAM)
lParam = aLi
(HICON) hiconi
hicon
Chapter 6, Messages
515
WM_COMMNOTIFY
Return Value
The return value is the handle of the icon that was previously associated
with the icon resource, or it is zero if an error occurred.
Example
See Also
STM_GETICON
WM_CHOOSEFONT_GETLOGFONT
WM- CHOOSEFONT - GETLOGFONT
wPararn = Oi
Iplf = (LPLOGFONT) IPararni
3.1
/* not used, must be zero
*/
/* address of a LOGFONT structure */
Return Value
Comments
See Also
IpIf
3.1
WM COMMNOT1FY
idDevice = wPararni
/* communication-device 1D */
nNotifyStatus=LOWORD(lParam)i/*notification-statusflag*/
516
idDevice
Meaning
See Also
2.x
#includeCdde. h>
WM DDE ACK
wParam = (WPARAM) hwnd;
lParam = MAKELPARAM(wLow, wHigh);
Chapter 6, Messages
517
hwnd
wLow
Message
Parameter
WM_DDE_EXECUTE and
all other messages
wHigh
wStatus
Parameter
Description
aTopic
hCommands
Comments
Message
Return Value
Description
altem
/* ddeack */
518
Posting
Except in response to the WM_DDE_INITIATE message, the application
posts the WM_DDE_ACK message by calling the PostMessage function,
not the Send Message function. When responding to
WM_DDE_INITIATE, the application sends the WM_DDE_ACK message
by calling Send Message.
When acknowledging any message with an accompanying altem atom,
the application posting WM_DDE_ACK can either reuse the altem atom
that accompanied the original message or delete it and create a new one.
When acknowledging WM_DDE_EXECUTE, the application that posts
WM_DDE_ACK should reuse the hCommands object that accompanied the
original WM_DDE_EXECUTE message.
If an application has initiated the termination of a conversation by posting
WM_DDE_TERMINATE and is awaiting confirmation, the waiting
application should not acknowledge (positively or negatively) any
subsequent messages sent by the other application. The waiting
application should delete any atoms or shared memory objects received
in these intervening messages (but should not delete the atoms in
response to the WM_DDE_ACK message).
Receiving
The application that receives WM_DDE_ACK should delete all atoms
accompanying the message.
If the application receives WM_DDE_ACK in response to a message with
an accompanying hData object, the application should delete the hData
object.
If the application receives a negative WM_DDE_ACK message posted in
reply to a WM_DDE_ADVISE message, the application should delete the
hOptions object posted with the original WM_DDE_ADVISE message.
If the application receives a negative WM_DDE_ACK message posted in
reply to a WM_DDE_EXECUTE message, the application should delete
the hCommands object posted with the original WM_DDE_EXECUTE
message.
See Also
Chapter 6, Messages
519
2.x
# incl ude<dde . h>
WM DDE ADVISE
wParam = (WPARAM) hwnd;
1* handle of posting window
*1
lPararn = MAKELPARAM (hOptions, altern) ; 1* send options and data item * 1
hwnd
hOptions
altem
Return Value
Comments
1* ddeadv *1
Posting
The application posts the WM_DDE_ADVISE message by calling the
PostMessage function, not the Send Message function.
The application allocates hOptions by calling the GlobalAlloc function
with the GMEM_DDESHARE option.
520
Receiving
The application posts the WM_DDE_ACK message to respond positively
or negatively. When posting WM_DDE_ACK, the application can reuse
the altem atom or delete it and create a new one. If the WM_DDE_ACK
message is positive, the application should delete the hOptions object;
otherwise, the application should not delete the object.
See Also
WM_DDE_DATA, WM_DDE_REQUEST
2.x
# incl ude::::dde . h>
WM DOE DATA
wParam = (WPARAM) hwnd;
lParam = MAKELPARAM(hData, altern);
Return Value
Comments
hwnd
hData
altem
Chapter 6, Messages
521
#include<dde. h>
typedef struct tagDDEDATA {
WORD
unused: 12,
fResponse:1,
fRelease:1,
reserved: 1,
fAckReq:1i
short
cfFormati
BYTE
Value[lli
}DDEDATAi
/* ddedat */
Posting
The application posts the WM_DDE_DATA message by calling the
PostMessage function, not the Send Message function.
The application allocates hData by calling the GlobalAlioc function with
the GMEM_DDESHARE option.
The application allocates altern by calling the GlobalAddAtom function.
If the receiving (client) application responds with a negative
The application should not set both the fAckReq and fRelease members
of the DDEDATA structure to FALSE. If both members are set to FALSE, it
is difficult for the posting (server) application to determine when to delete
hData.
Receiving
If fAckReq is TRUE, the application posts the WM_DDE_ACK message to
(client) application can request the server to send the actual data by
posting a WM_DDE_REQUEST message.
522
2.x
#include:::dde. h>
WM DOE EXECUTE
wParam = (WPARAM) hwndi
/* handle of posting window */
lParam = MAKELPARAM(reserved, hCommands)i /* commands to execute
*/
hwnd
reserved
hCommands
Return Value
Comments
Chapter 6, Messages
523
opcode parameters
The opcode is any application-defined single token. It cannot include
spaces, commas, parentheses, or quotation marks.
The parameters list can contain any application-defined value or values.
Multiple parameters are separated by commas, and the entire parameter
list is enclosed in parentheses. Parameters cannot include commas or
parentheses except inside a quoted string. If a bracket or parenthesis
character is to appear in a quoted string, it must be doubled-for
example,
"".
Posting
The application posts the WM_DDE_EXECUTE message by calling the
PostMessage function, not the SendMessage function.
The application allocates hCommands by calling the GlobalAlioc function
with the GMEM_DDESHARE option.
When processing a WM_DDE_ACK message posted in reply to a
WM_DDE_EXECUTE message, the application that posted the original
WM_DDE_EXECUTE message must delete the hCommands object sent
back in the WM_DDE_ACK message.
Receiving
The application posts the WM_DDE_ACK message to respond positively
or negatively, reusing the hCommands object.
See Also
PostMessage, WM_DDE_ACK
2.x
#include<dde. h>
WM DDE INITIATE
wParam = (WPARAM) hwnd;
/* sending window's handle */
lParam = MAKELPARAM(aApplication, aTopic); /* application and topic
*/
524
Return Value
Comments
hwnd
aApplication
aTopic
If the application has already obtained the window handle of the desired
When Send Message returns, the application deletes the aApplication and
aTopic atoms.
Chapter 6, Messages
525
Receiving
To complete the initiation of a conversation, the application responds
with one or more WM_DDE_ACK messages, where each message is for a
separate topic. When sending a WM_DDE_ACK message, the application
creates new aApplication and aTopic atoms; it should not reuse the atoms
sent with the WM_DDE_INITIATE message.
See Also
2.x
#include<dde. h>
WM DDE POKE
wParam = (WPARAM) hwnd;
lParam = MAKELPARAM(hData, altern);
*/
hwnd
hData
/* ddepok */
altem
526
Return Value
Comments
Posting
The posting (client) application should do the following:
1:1
Use the GlobalAddAtom function to create the atom for the data item.
iii
Delete the global memory object if the server application responds with
a negative WM_DDE_ACK message.
t1
Delete the global memory object if the client has set the fRelease
member of the DDEPOKE structure to FALSE and the server responds
with either a positive or negative WM_DDE_ACK.
Receiving
The receiving (server) application should do the following:
See Also
EI
WM_DDE_DATA
2.x
#include<:dde. h>
WM DDE REQUEST
wParam --;:" (WPARAM) hwnd;
/* handle of posting window
lPararn = MAKE LPARAM (cfForrnat I altern) ; / * clipboard format and i tern
*/
*/
hwnd
Chapter 6, Messages
527
Return Value
Comments
cfFormat
altern
Posting
The application posts the WM_DDE_REQUEST message by calling the
PostMessage function, not the Send Message function.
The application allocates altern by calling the GlobalAddAtom function.
Receiving
If the receiving (server) application can satisfy the request, it responds
with a WM_DDE_DATA message containing the requested data.
Otherwise, it responds with a negative WM_DDE_ACK message.
When responding with either a WM_DDE_DATA or WM_DDE_ACK
message, the application can reuse the altem atom or delete it and create a
new one.
See Also
2.x
# incl ude<dde . h>
WM DDE TERMINATE
wP~ram-:: (WPARAM) hwndi /* handle of posting window * /
lParam = OLi
/* not used, must be zero
*/
528
hwnd
Posting
The application posts the WM_DDE_TERMINATE message by calling the
PostMessage function, not the Send Message function.
Receiving
The application responds by posting a WM_DDE_TERMINATE message.
See Also
PostMessage
2.x
# incl ude:::dde . h>
WM DDE UNADVlSE
wParam = (WPARAM) hwnd;
lParam = MAKELPARAM(cfFormat, altern);
*/
*/
Return Value
Comments
hwnd
cfFormat
altern
Posting
The application posts the WM_DDE_UNADVISE message by calling the
PostMessage function, not the Send Message function.
Chapter 6, Messages
529
WM_PALETTEISCHANGING
Receiving
The application posts the WM_DDE_ACK message to respond positively
or negatively. When posting WM_DDE_ACK, the application can reuse
the altern atom or delete it and create a new one.
See Also
3.1
WM DROPFILES
hDrop = (HANDLE) wParam;
The WM_DROPFILES message is sent when the user releases the left
mouse button over the window of an application that has registered itself
as a recipient of dropped files.
Parameters
Return Value
See Also
hDrop
WM_PALETIEISCHANGING
3.1
WM PALETTEISCHANGING
hwndRealize = (HWND) wParam; /* handle of window to realize palette * /
Return Value
See Also
530
hwndRealize
3.1
WM POWER
fwPowerEvt
= wParam;
fwPowerEvt
Value
Meaning
PWR_SUSPENDREQUEST
PWR_SUSPENDRESUME
PWR_CRITICALRESUME
Return Value
Comments
Return Value
PWR_SUSPENDREQUEST
PWR_SUSPENDRESUME
PWR_CRITICALRESUME
a
a
Chapter 6, Messages
531
WM_SYSTEMERROR
The suspended mode is the state in which the greatest amount of power
savings occurs, but all operational data and parameters are preserved.
Random-access memory (RAM) contents are preserved, but many devices
are likely to be turned off.
See Also
EnumWindows
3.1
WM_SYSTEMERROR
3.1
WM SYSTEMERROR
wErrSpec = wParam;
Return Value
Comments
532
wErrSpec
WM_USER
2.x
WM USER
Meaning
othrough WM_USER-1
Chapter 6, Messages
533
WM_WINDOWPOSCHANGING
See Also
RegisterWindowMessage
3.1
WM_WINDOWPOSCHANGED
WM WINDOWPOSCHANGED
pwp = (canst WINDOWPOS FAR*) lParam;
/* structure address
*/
pwp
Return Value
Comments
See Also
3.1
WM_WINDOWPOSCHANGING
WM WINDOWPOSCHANGING
pwp = (WINDOWPOS FAR*) lParam;
534
WM_WINDOWPOSCHANGING
pwp
Return Value
Comments
See Also
WM_WINDOWPOSCHANGED
Chapter 6, Messages
535
Notification messages
2.x
See Also
DRAWITEMSTRUCT, WM_DRAWITEM
See Also
DRAWITEMSTRUCT, WM_DRAWITEM
BN_UNHILITE
The BN_UNHILITE notification message is sent when the highlight
should be removed from a button. This notification is provided for
compatibility with applications written prior to Windows version 3.0.
New applications should use the BS_OWNERDRAW button style and the
DRAWITEMSTRUCT structure for this task.
536
CBN_SELENDCANCEL
See Also
DRAWITEMSTRUCT, WM_DRAWITEM
CBN_CLOSEUP
3.1
Comments
wParam
IParam
This notification message is not sent to a combo box that has the
CBS_SIMPLE style.
The order in which notifications will be sent cannot be predicted. In
particular, a CBN_SELCHANGE notification may occur either before or
after a CBN_CLOSEUP notification.
See Also
CBN_SELENDCANCEL
3.1
Comments
See Also
wParam
IParam
Chapter 6, Messages
537
LBN_SELCANCEL
3.1
The CBN_SELENDOK notification message is sent when the user selects
an item and then either presses the ENTER key or clicks the DOWN ARROW
key to hide the list box of a combo box. This notification message is sent
before the CBN_CLOSEUP notification message to indicate that the user's
selection should be considered valid.
Parameters
Comments
See Also
wParam
IParam
3.1
LBN_SELCANCEL
The LBN_SELCANCEL notification message is sent when the user cancels
the selection in a list box. The parent window of the list box receives this
notification message through a WM_COMMAND message.
Parameters
538
wParam
IParam
Comments
This notification applies only to a list box that has the LBS_NOTIFY style.
See Also
Structures
3.1
ABC
/* abc */
TABC = record
abcA: Integer;
abcB: Word;
abcC: Integer;
end;
Members
abcA
abcB
abcC
Chapter 7, Structures
539
CBTACTIVATESTRUCT
Comments
See Also
The total width of a character is the sum of the A, B, and C spaces. Either
the A or the C space can be negative, to indicate underhangs or overhangs.
GetCharABCWidths
3.'
The CBT_CREATEWND structure contains information passed to a
WH_CBT hook function before a window is created.
typedef struct tagCBT_CREATEWND {
/* cbtcw */
CREATESTRUCT FAR* Ipcs;
HWND
hwndlnsertAfter;
CBT_CREATEWND;
TCBT CreateWnd=record
Ipcs: PCreateStruct;
hWndlnsertAfter: HWnd;
end;
Members
See Also
Ipcs
hwndlnsertAfter
CBTProc, SetWindowsHook
CBTACTIVATESTRUCT
3. ,
540
CHOOSECOLOR
TCBTActivateStruct=record
fMouse: Booli
hWndActive: HWndi
endi
Members
See Also
fMouse
hWndActive
SetWindowsHook
CHOOSECOLOR
3.1
TChooseColor = record
lStructSize: Longinti
hWndOwner: HWndi
hInstance: HWndi
rgbResult: Longinti
lpCustColors: PLonginti
Flags: Longinti
lCustData: Longinti
lpfnHook: function (Wnd: HWndi Message, wPararn: Wordi
lPararn: Longint): Wordi
lpTemplateNarne: PChari
endi
Members
IStructSize
Chapter 7, Structures
541
CHOOSECOLOR
hwndOwner
rgbResult
Flags
Value
CC_ENABLETEMPLATE
542
Meaning
CHOOSECOLOR
Value
Meaning
CC_ENABLETEMPLATEHANDLE
CC_PREVENTFULLOPEN
IpfnHook
Chapter 7, Structures
543
CHOOSE FONT
IpTemplateName
Comments
See Also
Some members of this structure are filled only when the dialog box is
created, and some have an initialization value that changes when the user
closes the dialog box. Whenever a description in the Members section
does not specify how the value of a member is assigned, the value is
assigned only when the dialog box is created.
ChooseColor
CHOOSEFONT
3.1
The CHOOSEFONT structure contains information that the system uses to
initialize the system-defined Font dialog box. After the user chooses the
OK button to close the dialog box, the system returns information about
the user's selection in this structure.
#include <commdlg.h>
typedef struct tagCHOOSEFONT { /* cf */
DWORD
lStructSizei
HWND
hwndOwneri
HDC
hDCi
LOGFONT FAR*
int
DWORD
COLORREF
LPARAM
UINT (CALLBACK*
LPCSTR
HI NSTANCE
LPSTR
UINT
int
int
lpLogFonti
iPointSizei
Flagsi
rgbColorSi
lCustDatai
lpfnHook) (HWND, UINT, WPARAM, LPARAM) i
lpTernplateNamei
hlnstance
lpszStyle
nFontType
nSizeMini
nSizeMaxi
CHOOSEFONTi
544
CHOOSEFONT
TChooseFont = record
lStructSize: Longint;
hWndOwner: HWnd;
hDC: HDC;
lpLogFont: PLogFont;
iPointSize: Integer;
Flags: Longint;
rgbColors: Longint;
lCustData: Longint;
lpfnHook: function (Wnd: HWnd; Msg, wParam: Word; lParam: Longint):
Word;
lpTemplateName: PChar;
hInstance: THandle;
lpszStyle: PChar;
nFontType: Word;
nSizeMin: Integer;
nSizeMax: Integer;
end;
Members
IStructSize
hwndOwner
hOC
IpLogFont
Chapter 7, Structures
545
CHOOSEFONT
iPointSize
Flags
Value
Meaning
CF_APPLY
CF_ANSI ONLY
CF_BOTH
CF_TTONLY
CF_EFFECTS
CF_ENABLETEMPLATE
IpTemplateName.
CF_ENABLETEMPLATEHANDLE
CF_FIXEDPITCHONLY
546
CHOOSEFONT
Value
Meaning
CF_FORCEFONTEXIST
CF_INmOLOGFONTSTRUCT
CF_NOOEMFONTS
CF_NOSIMULATIONS
CF_NOVECTORFONTS
CF_PRINTERFONTS
Chapter 7, Structures
547
CHOOSEFONT
Value
Meaning
CF_SCALABLEONLY
CF_SCREENFONTS
CF_SHOWHELP
CF_USE STYLE
CF_WYSIWYG
rgbColors
ICustData
548
CHOOSEFONT
IpfnHook
IpTemplateName
hlnstance
IpszStyle
nFontType
Chapter 7, Structures
549
CHOOSEFONT
Value
Meaning
BOLD_FONTTYPE
ITALIC_FONTTYPE
structure.
Specifies that the font is
italic. This value applies
only to TrueType fonts.
This value corresponds to
the value of the ntmFlags
member of the
NEWTEXTMETRIC
PRINTER_FONTTYPE
REGULAR_FONTTYPE
SCREEN_FONTTYPE
SIMULATED_FONTTYPE
nSizeMin
nSizeMax
structure.
Specifies that the font is a
printer font.
Specifies that the font is
neither bold nor italic.
This value applies only to
TrueType fonts. This value
corresponds to the value
of the ntmFlags member
of the NEWTEXTMETRIC
structure.
Specifies that the font is a
screen font.
Specifies that the font is
simulated by GDI. This is
not set if the
CF_NOSIMULATIONS
flag is set.
See Also
550
Choose Font
CLASSENTRY
CLASSENTRY
3.1
The CLASSENTRY structure contains the name of a Windows class "and a
near pointer to the next class in the list.
#include <toolhelp.h>
typedef struct tagCLASSENTRY
/* ce */
DWORD
dwSize;
HMODULE hlnst;
char
szClassName[MAX_CLASSNAME + 1];
WORD
wNext;
CLASSENTRY;
TClassEntry = record
dwSize: Longint;
hlnst: THandle;
szClassName: array[O .. Max_ClassName] of Char;
wNext: Word;
end;
Members
dwSize
hlnst
szClassName
wNext
See Also
ClassFirst, ClassNext
Chapter 7, Structures
551
CO MSTAT
CO MSTAT
3.1
The COMSTAT structure contains information about a communications
device.
typedef struct tagCOMSTAT
BYTE status;
UINT cblnQue;
UINT cbOutQue;
}COMSTAT;
TComStat = record
Status: Byte;
cblnQue: Word;
cbOutQue: Word;
end;
Members
status
/*
/*
/*
/*
crnst
status of transmission
count of characters in Rx Queue
count of characters in Tx Queue
*/
*/
*/
*/
Meaning
CSTF_CTSHOLD
CSTF_RLSDHOLD
CSTF_TXIM
cblnQue
552
CONVCONTEXT
cbOutQue
See Also
GetCommError
CONVCONTEXT
3.1
*/
TConvContext = record
cb: Word;
wFlags: Word;
wCountryID: Word;
iCodePage: Integer;
dwLangID: Longint;
dwSecurity: Longint;
end;
Members
cb
wFlags
wCountrylD
iCodePage
dwLanglD
dwSecurity
See Also
GetKBCodePage
Chapter 7, Structures
553
CONVINFO
3.1
CONVINFO
The CONVINFO structure contains information about a dynamic data
exchange (DDE) conversation.
#include <ddeml.h>
typedef struct tagCONVINFO { /* ci * /
DWORD
cbi
DWORD
hUseri
HCONV
hConvPartneri
HSZ
hszSvcPartneri
HSZ
hszServiceReqi
HSZ
hszTopici
HSZ
hszItemi
DINT
wFmti
DINT
wTypei
DINT
wStatusi
UINT
wConvsti
UINT
wLastErrori
HCONVLIST hConvListi
CONVCONTEXT ConvCtxtj
CONVINFOi
TConvInfo = record
cb: Longinti
hUser: Longinti
hConvPartner: HConvi
hszSvcPartner: HSZi
hszServiceReq: HSZi
hszTopic: HSZi
hszItem: HSZi
wFmt: Wordi
wType: Wordi
wStatus: Wordi
wConvst: Wordi
wLastError: Wordi
hConvList: HConvListj
ConvCtxt: TConvContexti
end;
Members
cb
hUser
hConvPartner
554
CONVINFO
hszSvcPartner
hszServiceReq
hszTopic
hszltem
wFmt
wType
Value
Meaning
XTYP _ADVDATA
XTYP_ADVREQ
XTYP _ADVSTART
XTYP_ADVSTOP
XTYP_CONNECT
XTYP_CONNECT_CONFIRM
XTYP _DISCONNECT
XTYP_ERROR
XTYP_EXECUTE
XTYP_MONITOR
XTYP_POKE
XTYP _REGISTER
XTYP _REQUEST
XTYP_UNREGISTER
Chapter 7, Structures
555
CONVINFO
Value
Meaning
XTYP_WILDCONNECT
XTYP_XACT_COMPLETE
wStatus
wConvst
ST_INLIST
ST_ISLOCAL
ST_ISSELF
ST_TERMINATED
See Also
556
XST_INITl
XST_INIT2
XST_NULL
XST_POKEACKRCVDX
ST_POKESENT
XST_REQSENT
XST_UNADVACKRCV
DXST_UNADVSENT
wLastError
hConvList
ConvCtxt
CONVCONTEXT
CPLINFO
CPLINFO
3.1
The CPLINFO structure contains resource information and a user-defined
value for an extensible Control Panel application.
#include <cpl. h>
typedef struct tagCPLINFO { 1* cpli * 1
int
idIcon;
int
idName;
int
idInfo;
LONG lData;
CPLINFO;
TCPLInfo = record
idIcon: Integer;
idName: Integer;
idInfo: Integer;
lData: Longint;
end;
Members
icon
name
info
user
idlcon
idName
idlnfo
IData
Chapter 7, Structures
557
CTLINFO
3.1
CTLINFO
The CTLINFO structure defines the class name and version number for a
custom control. The CTLINFO structure also contains an array of
CTlTYPE structures, each of which lists commonly used combinations of
control styles (called variants), with a short description and information
about the suggested size.
#include <custcntl.h>
typedefstructtagCTLINFO{
UINT
wVersion;
UINT
wCtlTypes;
char
szClass[CTLCLASS];
char
szTitle[CTLTITLE];
char
szReserved[lO];
CTLTYPE Type[CTLTYPES];
CTLINFO;
/* control version
/* control types
/* control class name
/* control title
/* reserved for future use
/* control type list
*/
*/
*/
*/
*/
*/
TCtllnfo = record
wVersion: Word;
{ control version }
wCtlTypes: Word;
{ control types }
szClass: array[O .. ctlClass-l] of Char;
{ control class name}
szTitle: array[O .. ctlTitle-l] of Char;
{ control title}
szReserved: array[O .. 9] of Char;
{ reserved for future use}
ctType: array[O .. ctlTypes-l] of TCtlType;
{ control type list}
end;
Members
558
wVersion
wCtlTypes
szClass
szTitie
CTLSTYLE
Type
Comments
See Also
CTlSTYlE, CTlTYPE
CTLSTYLE
3. 1
The CTlSTYlE structure specifies the attributes of the selected control,
including the current style flags, location, dimensions, and associated text.
#include <custcntl.h>
typedefstructtagCTLSTYLE{
UINT
wX;
UINT
wY;
UINT
wCx;
UINT
wCy;
WId;
UINT
DWORD
dwStyle;
char
szClass[CTLCLASS);
szTitle[CTLTITLE);
char
CTLSTYLE;
/*
/*
/*
/*
/*
/*
/*
/*
x-origin of control
y-origin of control
width of control
height of control
control child id
control style
name of control class
control text
*/
*/
*/
*/
*/
*/
*/
*/
TCtlStyle = record
wX: Word;
x origin of control
wY: Word;
y origin of control
wCx: Word;
width of control }
wCy: Word;
height of control }
wId: Word;
control child id }
dwStyle: Longint;
control style }
szClass: array[O .. ctlClass-l) of Char;
{ name of control class
szTitle: array[O .. ctlTitle-l) of Char;
{ control text }
end;
Chapter 7, Structures
559
CTLSTYLE
Members
wX
wY
wCx
wCy
wid
dwStyle
szClass
szTitle
Comments
See Also
560
CTLTYPE
3.1
CTLTYPE
The CTlTYPE structure contains information about a control in a
particular class. The CTLINFO structure includes an array of CTlTYPE
structures.
#include <custcntl.h>
typedefstructtagCTLTYPE{
UINT
wType;
UINT
wWidth;
UINT
wHeight;
DWORD
dwStyle;
char
szDescr[CTLDESCR];
CTLTYPE;
/* type style
/* suggested width
/* suggested height
/* default style
/* menu name
*/
*/
*/
*/
*/
Members
wType
wWidth
wHeight
dwStyle
szDescr
See Also
CTLINFO, CTlSTYlE
Chapter 7, Structures
561
DDEACK
2.x
DDEACK
/* ddeack */
TDDEAck = record
Flags: Word;
end;
Members
bAppReturnCode
tBusy
tAck
See Also
562
DDEADVISE
2.x
DDEADVISE
The DDEADVISE structure contains flags that specify how a server should
send data to a client during an advise loop. A client passes the handle of a
DDEADVISE structure to a server as part of a WM_DDE_ADVISE
message.
#include <dde.h>
typedef struct tagDDEADVISE {
WORD
reserved: 14,
fDeferUpd: 1,
fAckReq: 1;
short
cfFormat;
DDEADVISE;
/* ddeadv */
TDDEAdvise = record
Flags: Word;
cfFormat: Integer;
end;
Members
fDeferUpd
fAckReq
cfFormat
Chapter 7, Structures
CF_OEMTEXT
CF_PALETTE
CF_PENDATA
CF_SYLK
CF_TEXT
CF_TIFF
563
DDEDATA
DDEDATA
2.x
The DDEDATA structure contains the data and information about the data
sent as part of a WM_DDE_DATA message.
#include <dde.h>
typedef struct tagDDEDATA {
WORD
unused:12,
fResponse:1,
fRelease:1,
reserved: 1,
fAckReq: 1;
short
cfFormat;
BYTE
Value[l];
DDEDATA;
/* ddedat */
TDDEData= record
Flags: Word;
cfFormat: Integer;
Value: array[O .. O] of Char;
end;
Members
fResponse
fRelease
fAckReq
cfFormat
564
CF_OEMTEXT
CF_PALETTE
CF_PENDATA
CF_SYLK
CF_TEXT
CF_TIFF
DDEPOKE
See Also
2.x
DDEPOKE
The DDEPOKE structure contains the data and information about the data
sent as part of a WM_DDE_POKE message.
#include <dde.h>
typedef struct tagDDEPOKE {
WORD unused: 13,
fRelease:1,
fReserved:2;
short cfFormat;
BYTE Value[l];
DDEPOKE;
/* ddepok */
TDDEPoke = record
Flags: Word;
cfFormat: Word;
Value: array[O .. O] of Byte;
end;
Members
fRelease
cfFormat
CF_DCF_PALETTE
CF_DCF_PENDATA
CF_DCF_SYLK
CF_DCF_TEXT
CF_METAFILEPICT
Value
Chapter 7, Structures
CF_OEMTEXT
CF_PALETTE
CF_PENDATA
CF_SYLK
CF_TEXT
CF_TIFF
565
DEBUGHOOKINFO
DEBUGHOOKINFO
3.1
TDebugHookInfo = record
hModuleHook: THandle;
reserved: Longint;
IParam: Longint;
wParm: Word;
code: Integer;
end;
Members
hModuleHook
reserved
IParam
wParam
code
See Also
566
function.
Specifies the value to be passed to the hook in the
code parameter of the DebugProc callback function.
DebugProc, SetWindowsHook
DEVNAMES
3.1
DEVNAMES
TDevNames = record
wDriverOffset: Word;
wDeviceOffset: Word;
wOutputOffset: Word;
wDefault: Word;
end;
Members
wDriverOffset
wDeviceOffset
wOutputOffset
wDefault
Chapter 7, Structures
567
DOCINFO
PrintDlg
DOCINFO
3.1
The DOCINFO structure contains the input and output filenames used by
the StartDoc function.
typedef struct {
/* di */
int
cbSize;
LPCSTR IpszDocName;
LPCSTR IpszOutput;
DOC INFO;
TDocInfo = record
cbSize: Integer;
IpszDocName: PChari
IpszOutput: PChar;
end;
Members
cbSize
IpszDocName
IpszOutput
See Also
568
StartDoc
DRVCONFIGINFO
DRIVERINFOSTRUCT
3.1
1* drvinfst */
TDriverInfoStruct=record
length: Word;
hDriver: THandle;
hModule: THandle;
szAliasName: array[O .. 128] of Char;
end;
Members
length
See Also
GetDriverlnfo
DRVCONFIGINFO
3.1
Chapter 7, Structures
569
EVENTMSG
TDrvConfigInfo=record
dwDCISize: Longint;
IpszDCISectionName: PChar;
IpszDCIAliasName: PChar;
end;
Members
dwDCISize
IpszDCIAliasName
See Also
DRV_CONFIGURE, DRV_INSTALL
2.x
EVENTMSG
/* em */
TEventMsg = record
message: Word;
paramL: Word;
paramH: Word;
time: Longint;
end;
Members
message
paramL
paramH
time
See Also
570
JournalPlaybackProc, SetWindowsHook
FINDREPLACE
FINDREPLACE
3.1
The FINDREPLACE structure contains information that the system uses to
initialize a system-defined Find dialog box or Replace dialog box. After
the user chooses the OK button to close the dialog box, the system returns
information about the user's selections in this structure.
#include <commdlg.h>
/* fr */
typedef struct tagFINDREPLACE
DWORD
lStructSizei
HWND
hwndOwner i
HINSTANCE hInstancei
DWORD
Flagsi
LPSTR
lpstrFindWhati
LPSTR
lpstrReplaceWithi
UINT
wFindWhatLeni
UINT
wReplaceWithLeni
LPARAM
lCustDatai
UINT
(CALLBACK* lpfnHook) (HWND, UINT, WPARAM, LPARAM) i
LPCSTR
lpTemplateNamei
FINDREPLACEi
TFindReplace=record
lStructSize: Longinti
hWndOwner: HWndi
hInstance: THandlei
Flags: Longinti
lpstrFindWhat: PChari
lpstrReplaceWith: PChari
wFindWhatLen: Wordi
wReplaceWithLen: Wordi
lCustData: Longinti
lpfnHook: function (Wnd: HWndi Msg, wParam: Wordi lParam: Longint):
Wordi
lpTemplateName: PChari
end;
Members
IStructSize
hwndOwner
Chapter 7, Structures
571
FINDREPLACE
Flags
Value
FR_ENABLEHOOK
FR_ENABLETEMPLATE
FR_ENABLETEMPLATEHANDLE
FR_HIDEMATCHCASE
572
Meaning
FINDREPLACE
Value
Meaning
FR_HIDEWHOLEWORD
FR_HIDEUPDOWN
FR_MATCHCASE
FR_NOMATCHCASE
FR_NOUPDOWN
FR_NOWHOLEWORD
FR_REPLACE
FR_REPLACEALL
FR_SHOWHELP
FR_WHOLE WORD
IpstrFindWhat
Chapter 7, Structures
573
FINDREPLACE
IpstrReplaceWith
wFindWhatLen
wReplaceWithLen
ICustData
IpfnHook
IpTemplateName
574
FIXED
See Also
Some members of this structure are filled only when the dialog box is
created, some are filled only when the user closes the dialog box, and
some have an initialization value that changes when the user closes the
dialog box. Whenever a description in the Members section does not
specify how the value of a member is assigned, the value is assigned only
when the dialog box is created.
FindText, ReplaceText
FIXED
3.1
The FIXED structure contains the integral and fractional parts of a
fixed-point real number.
typedef struct tagFIXED {
DINT
fract;
value;
int
} FIXED;
/* fx */
TF ixed = record
fract: Word;
value: Integer;
end;
Members
Comments
See Also
fract
value
The FIXED structure is used to describe the elements of the MAT2 and
POINTFX structures.
GetGlyphOutiine
Chapter 7, Structures
575
FMS_GETDRIVEINFO
FMS_GETDRIVEINFO
The FMS_GETDRIVEINFO structure contains information about the drive
that is selected in the currently active File Manager window.
#include <wfext.h>
typedefstructtagFMS_GETDRIVEINFO{/*fmsgdi*/
DWORD dwTotalSpacei
DWORD dwFreeSpace;
char szPath[260]i
char szVolume[14]i
char szShare[128]i
FMS_GETDRIVEINFO, FAR *LPFMS_GETDRIVEINFO;
TGetDriveInfo = record
dwTotalSpace: Longinti
dwFreeSpace: Longint;
sZPath: array[O .. 259] of Chari { current directory }
volume label}
szVolume: array[O .. 13] of Chari
szShare: array[O .. 127] of Chari { if this is a net drive
end;
Members
dwTotalSpace
dwFreeSpace
szPath
szVolume
szShare
See Also
576
FMExtensionProc, FM_GETDRIVEINFO
FMS_GETFILESEL
FMS_GETFILESEL
The FMS_GETFILESEL structure contains information about a selected
file in File Manager's directory window or Search Results window.
#include <wfext.h>
typedef struct tagFMS_GETFILESEL { /* fmsgfs */
UINT wTime;
UINT wDate;
DWORD dwSize;
BYTE bAttr;
char szName[260];
FMS_GETFILESEL;
TGetFileSel = record
wTime: Word;
wDate: Word;
dwSize: Longint;
bAttr: Byte;
szName: array[O .. 259] of Char;
end;
Members
wTime
wDate
dwSize
bAttr
szName
See Also
FMExtensionProc
Chapter 7, Structures
577
Members
dwSize
szMenuName
hMenu
wMenuDelta
See Also
578
{output}
FMExtensionProc
GLOBALENTRY
GLOBALENTRY
3.1
The GLOBALENTRV structure contains information about a memory
object on the global heap.
#include <toolhelp.h>
typedef struct tagGLOBALENTRY
DWORD
dwSize;
DWORD
dwAddress;
DWORD
dwBlockSize;
HGLOBAL hBlock;
WORD
wcLock;
WORD
wcPageLock;
WORD
wFlags;
BOOL
wHeapPresent;
HGLOBAL hOwner;
WORD
wType;
WORD
wData;
DWORD
dwNext;
DWORD
dwNextAlt;
GLOBALENTRY;
/* ge */
TGlobalEntry = record
dwSize: Longint;
dwAddress: Longint;
dwBlockSize: Longint;
hBlock: THandle;
wcLock: Word;
wcPageLock: Word;
wFlags: Word;
wHeapPresent: Bool;
hOwner: THandle;
wType: Word;
wData: Word;
dwNext: Longint;
dwNextAlt: Word;
end;
Members
dwSize
dwAddress
dwBlockSize
hBlock
wcLock
Chapter 7, Structures
579
GLOBALENTRV
wcPageLock
wFlags
Meaning
wHeapPresent
hOwner
wType
GT_TASK
Meaning
580
GLOBALENTRY
Value
Meaning
GT_SENTINEL
GT _BURGERMASTER
wData
Meaning
GD_ACCELERATORS
GD_CURSOR
GD_CURSORCOMPONENT
GD_ERRTABLE
GD_FONT
Chapter 7, Structures
581
GLOBALINFO
Value
Meaning
GO_ICONCOMPONENT
GO_MENU
GO_NAMETABLE
GO_RCOATA
GO_STRING
GO_USEROEFINEO
dwNext
dwNextAlt
See Also
GLOBALINFO
3.1
The GLOBALINFO structure contains information about the global heap.
#include <toolhelp.h>
typedef struct tagGLOBALINFO {
DWORD dwSize;
WORD wcItems;
WORD wcItemsFree;
WORD wcItemsLRU;
GLOBAL INFO ;
/* gi */
TGlobalInfo = record
dwSize: Longint;
wcItems: Word;
wcItemsFree: Word;
wcItemsLRU; Word;
end;
Members
dwSize
wcltems
582
GLYPHMETRICS
wcltemsLRU
See Also
Globallnfo, GLOBALENTRY
3.1
GLYPHMETRICS
/* gm * /
TGlyphMetrics=record
gmBlackBoxX: Word;
gmBlackBoxY: Word;
gmptGlyphOrigin: TPoint;
gmCellIncX: Integer;
gmCellIncY: Integer;
end;
Members
gmBlackBoxX
gmBlackBoxY
gmptGlyphOrigin
gmCelllncX
gmCellincY
Comments
See Also
Chapter 7, Structures
583
HELPWININFO
3.1
HARDWAREHOOKSTRUCT
/* hhs * /
THardwareHookStruct=record
hWnd: HWndi
wMessage: Word;
wParam: Word;
IParam: Longint;
end;
Members
hWnd
wMessage
wParam
IParam
HELPWININFO
3.1
The HELPWININFO structure contains the size and position of a
secondary help window. An application can set this size by calling the
WinHelp function with the HELP_SETWINPOS value.
typedef struct {
int wStructSize;
int Xi
int y;
int dx;
int dy;
int wMax;
char rgchMember[2]i
HELPWININFO i
584
HSZPAIR
THelpWinInfo = record
wStructSize: Integer;
x: Integer;
y: Integer;
dx: Integer;
dy: Integer;
wMax: Integer;
rgchMernber: array[O .. l] of Char;
end;
Members
wStructSize
dx
dy
wMax
See Also
Microsoft Windows Help divides the display into 1024 units in both the xand y-directions. To create a secondary window that fills the upper-left
quadrant of the display, for example, an application would specify zero
for the x and y members and 512 for the dx and dy members.
WinHelp
HSZPAIR
3.1
The HSZPAIR structure contains a dynamic data exchange (DDE) service
name and topic name. A DDE server application can use this structure
during an XTYP_WILDCONNECT transaction to enumerate the
service/topic name pairs that it supports.
#include <ddeml.h>
typedef struct tagHSZPAIR
HSZ hszSvc;
HSZ hszTopic;
} HSZPAIR;
Chapter 7, Structures
/* hp */
585
KERNINGPAIR
THSZPair = record
hszSvc: HSZ;
hszTopic: HSZ;
end;
Members
hszSvc
hszTopic
KERNINGPAIR
3.1
The KERNINGPAIR structure defines a kerning pair.
typedef struct tagKERNINGPAIR {
WORD wFirst;
WORD wSecond;
int iKernAmount;
KERNINGPAIR;
TKerningPair=record
wFirst: Word;
wSecond: Word;
iKernAmount: Integer;
end;
Members
wFirst
wSecond
iKernAmount
See Also
586
GetKerningPairs
LOCALENTRY
3.1
LOCALENTRY
1* le *1
TLocalEntry = record
dwSize: Longint;
hHandle: THandle;
wAddress: Word;
wSize: Word;
wFlags: Word;
wcLock: Word;
wType: Word;
hHeap: Word;
wHeapType: Word;
wNext: Word;
end;
Members
dwSize
hHandle
wAddress
wSize
wFlags
Meaning
LF_FREE
LF_MOVEABLE
Chapter 7, Structures
587
LOCALENTRY
wcLock
wType
LT_GDCBRUSH
LT_GDCDISABLED_DC
LT_GDCPALETIE
LT_GDCPEN
LT_GDCRGN
588
Meaning
LOCALENTRY
Value
Meaning
LT_USER_ED
hHeap
Chapter 7, Structures
589
LOCALINFO
wHeapType
wNext
Comments
See Also
Specifies the type of local heap. This type can be one of the
following values:
Value
Meaning
NORMAL_HEAP
USER_HEAP
GDCHEAP
The wType values are for informational purposes only. Microsoft reserves
the right to change or delete these tags at any time. Applications should
never directly change items on the system heaps, as this information will
change in future versions. The wType values for the USER module are
included only in the debugging versions of USER.EXE.
LocalFirst, LocalNext, LOCALINFO
LOCALINFO
3.1
The LOCALINFO structure contains information about the local heap.
#include <toolhelp.h>
typedef struct tagLOCALINFO {
DWORD dwSize;
WORD
wcltems;
} LOCALINFO;
/* Ii */
TLocallnfo = record
dwSize: Longint;
wcltems: Word;
end;
Members
See Also
590
dwSize
wcltems
Locallnfo, LOCALENTRY
MAT2
MAT2
3.1
The MAT2 structure contains the values for a transformation matrix.
typedef struct tagMAT2 {
FIXED eM11;
FIXED eM12;
FIXED eM21;
FIXED eM22;
MAT2;
TMat2 =
eM11:
eM12:
eM21:
eM22:
end;
Members
eM12
eM22
See Also
record
TFixed;
TFixed;
TFixed;
TFixed;
eM11
eM21
Comments
/* mat2 */
Chapter 7, Structures
591
MEMMANINFO
MEMMANINFO
3.1
TMemManlnfo = record
dwSize: Longint;
dwLargestFreeBlock: Longint;
dwMaxPagesAvailable: Longint;
dwMaxPagesLockable: Longint;
dwTotalLinearSpace: Longint;
dwTotalUnlockedPages: Longint;
dwFreePages: Longint;
dwTotalPages: Longint;
dwFreeLinearSpace: Longint;
dwSwapFilePages: Longint;
wPageSize: Word;
end;
Members
592
dwSize
dwLargestFreeBlock
dwMaxPagesAvailable
dwMaxPagesLockable
METAHEADER
See Also
dwTotalLinearSpace
dwTotalUnlockedPages
dwFreePages
dwTotalPages
dwFreeLinearSpace
dwSwapFi lePages
wPageSize
MemManlnfo
METAHEADER
3.1
The METAHEADER structure contains information about a metafile.
typedef struct tagMETAHEADER {
UINT mtType;
UINT mtHeaderSize;
UINT mtVersion;
DWORD mtSize;
UINT mtNoObjects;
DWORD mtMaxRecord;
UINT mtNoParameters;
METAHEADER;
/*
mh
*/
TMetaHeader=record
mtType : Word;
mtHeaderSize : Word;
mtVersion : Word;
mtSize : Longint;
mtNoObjects : Word;
mtMaxRecord : Longint;
mtNoParameters : Word;
end;
Members
mtType
Chapter 7, Structures
593
METARECORD
Value
Meaning
Metafile is in memory.
Metafile is in a disk file.
mtHeaderSlze
mtVersion
mtSize
mtNoObjects
See Also
mtMaxRecord
mtNoParameters
Reserved.
METARECORD
METARECORD
3.1
The METARECORD structure contains a metafile record.
typedef struct tagMETARECORD {
DWORD rdSize;
UINT rdFunction;
UINT rdParm[l];
METARECORD;
/* rnr * /
TMetaRecord = record
rdSize: Longint;
rdFunction: Word;
rdParm: array[O .. O] of Word;
end;
Members
rdSize
rdFunction
rdParm
See Also
594
METAHEADER
MINMAXINFO
3.1
MINMAXINFO
/* mmi */
TMinMaxInfo = record
ptReserved: TPoint;
ptMaxSize: TPoint;
ptMaxPosition: TPoint;
ptMinTrackSize: TPoint;
ptMaxTrackSize: TPoint;
end;
Members
ptReserved
ptMaxSize
ptMaxPosition
ptMi nTrackSize
ptMaxTrackSize
See Also
POINT, WM_GETMINMAXINFO
Chapter 7, Structures
595
MODULEENTRV
MODULEENTRY
3.1
TModuleEntry=record
dwSize: Longint;
szModule : array[O .. max_Module_Name] of Char;
hModule: THandle;
wUsageFlags: Word;
szExePath: array[O . max_Path] of Char;
wNext: Word;
end;
Members
dwSize
szModule
hModule
wcUsage
szExePath
wNext
See Also
596
MONCBSTRUCT
MONCBSTRUCT
3.1
/* mcbst */
TMonCBStruct=record
cb: Word;
wReserved: Word;
dwTime: Longint;
hTask: THandle;
dwRet: Longint;
wType: Word;
wFmt: Word;
hConv: HConv;
hszl: HSZ;
hsz2: HSZ;
hData: HDDEData;
dwDatal: Longint;
dwData2: Longint;
end;
Members
cb
wReserved
Reserved.
dwTime
hTask
Chapter 7, Structures
597
MONCONVSTRUCT
dwRet
wType
wFmt
hConv
hsz1
dwData1
Identifies a string.
Identifies the data (if any) exchanged during the
transaction.
Specifies additional data.
dwData2
hsz2
hData
See Also
3.1
MONCONVSTRUCT
UINT
cb;
BOOL
fConnect;
DWORD
dwTime;
HANDLE hTask;
HSZ
hszSvc;
HSZ
hszTopic;
HCONV
hConvClient;
HCONV
hConvServer;
} MONCONVSTRUCT;
598
MONERRSTRUCT
TMonConvStruct=record
cb: Word;
fConnect: Bool;
dwTime: Longint;
hTask: THandle;
hszSvc: HSz;
hszTopic: HSz;
hConvClient: HConv;
hConvServer: HConv;
end;
Members
cb
fConnect
dwTime
hTask
hszSvc
hszTopic
hConvClient
See Also
MONERRSTRUCT
3.1
Chapter 7, Structures
/* mest */
599
MONHSZSTRUCT
TMonErrStruct = record
cb: Word;
wLastError: Word;
dwTime: Longint;
hTask: THand1e;
end;
Members
See Also
.cb
wLastError
dwTime
hTask
MONHSZSTRUCT
3.1
cb;
BOOL
fsAction;
DWORD dwTime;
HSZ
hsz;
HANDLE hTask;
WORD
wReserved;
char
str [1] ;
MONHSZSTRUCT;
TMonHSZStruct=record
cb: Word;
fsAction: Bool;
mh
dwTime: Longint;
HSZ: HSZ;
hTask: THandle;
wReserved: Word;
Str: array[O .. O] of Char;
value
end;
600
MONHSZSTRUCT
Members
cb
fsAction
Meaning
MH_CLEANUP
MH_CREATE
dwTime
hsz
See Also
hTask
wReserved
Reserved.
str
Chapter 7, Structures
601
MONLINKSTRUCT
3.1
MONLINKSTRUCT
/* mlst */
hTaski
BOOL
fEstablishedi
BOOL
fNoData;
HSZ
hSZSVCi
HSZ
hszTopic;
HSZ
hszItemi
UINT
wFmti
BOOL
fServer;
HCONV
hConvServer;
HCONV
hConvClient;
MONLINKSTRUCT;
TMonLinkStruct=record
cb: Word;
dwTime: Longint;
hTask: THandle;
fEstablished: Booli
fNoData: Bool;
hszSvc: HSz
hszTopic: HSz;
hszItem: HSz;
wFmt: Wordi
fServer: Bool;
hConvServer: HConv;
hConvClient: HConv;
end;
Members
602
cb
dwTime
hTask
MONMSGSTRUCT
fEstablished
fNoData
hszSvc
hszTopic
hszltem
wFmt
fServer
See Also
MONMSGSTRUCT
3.1
cbi
HWND
hwndToi
DWORD
dwTime i
HANDLE hTaski
UINT
wMsgi
WPARAM wParamj
LFARAM lParamj
} MONMSGSTRUCTj
Chapter 7, Structures
603
MOUSEHOOKSTRUCT
TMonMsgStruct = record
cb: Word;
hWndTo: HWnd;
dwTime: Longint;
hTask: THandle;
wMsg: Word;
wParam: Word;
lParam: Longint;
end;
Members
cb
hwndTo
dwTime
hTask
wMsg
wParam
IParam
See Also
MOUSEHOOKSTRUCT
3.1
TMouseHookStruct=record
pt: TPoint;
hWnd: HWnd;
wHitTestCode: Word;
dwExtraInfo: Longint;
end;
604
NCCALCSIZE_PARAMS
Members
See Also
pt
Specifies a POINT structure that contains the xand y-coordinates of the mouse cursor, in screen
coordinates.
hwnd
wHitTestCode
dwExtralnfo
GetMessageExtralnfo,SetWindowsHook
3.1
The NCCALCSIZE_PARAMS structure contains information that an
application can use while processing the WM_NCCALCSIZE message to
calculate the size, position, and valid contents of the client area of a
window.
typedef struct tagNCCALCSIZE_PARAMS
RECT
rgrc[3];
WINDOWPOS FAR* lppos;
NCCALCSIZE_PARAMS;
TNCCalcSize Params=record
rgrc: array[O .. 2] of TRect;
lppos: PWindowPos;
end;
Members
rgrc
Ippos
Chapter 7, Structures
605
NEWCPLINFO
See Also
NEWCPLINFO
3.1
The NEWCPLINFO structure contains resource information and a
user-defined value for a Control Panel application.
#include <cpl.h>
typedef struct tagNEWCPLINFO
DWORD
dwSize;
DWORD
dwFlags;
DWORD
dwHelpContext;
LONG
lData;
HICON
hlcon;
char
szName[32];
char
szInfo[64];
char
szHelpFile[128];
NEWCPLINFO;
/* ncpli */
TNewCPLlnfo=record
dwSize: Longint;
similar to the commdlg
dwFlags: Longint;
dwHelpContext: Longint;
help context to use }
lData: Longint;
user defined data }
Icon: Hlconi { icon to use, this is owned by CONTROL.EXE (may be
deleted) }
szName: array[O .. 31] of Chari
short name }
szInfo: array[O .. 63] of Char;
long name (status line)
szHelpFile: array[O .. 127] of Chari
path to help file to use }
end;
Members
606
dwSize
dwFlags
dwHelpContext
IData
NEWTEXTMETRIC
hlcon
szName
szlnfo
szHelpFile
2.x
NEWTEXTMETRIC
Chapter 7, Structures
/* ntm */
607
NEWTEXTMETRIC
TNewTextMetric = record
tmHeight: Integer;
tmAscent: Integer;
tmDescent: Integer;
tmInternalLeading: Integer;
tmExternalLeading: Integer;
tmAveCharWidth: Integer;
tmMaxCharWidth: Integer;
tmWeight: Integer;
tmItalic: Byte;
tmUnderlined: Byte;
tmStruckOut: Byte;
tmFirstChar:Byte;
tmLastChar: Byte;
tmDefaultChar: Byte;
tmBreakChar: Byte;
tmPitchAndFamily: Byte;
tmCharSet: Byte;
tmOverhang: Integer;
tmDigitizedAspectX: Integer;
tmDigitizedAspectY: Integer;
ntmFlags: Longint;
ntmSizeEM: Word;
ntmCellHeight: Word;
ntmAvgWidth: Word;
end;
Members
tmHeight
tmAscent
tmDescent
608
tmlnternalLeading
NEWTEXTMETRIC
tmMaxCharWidth
tmWeight
Value
FW_DONTCARE
FW_THIN
FW_EXTRALIGHT
FW_ULTRALIGHT
FW_LIGHT
FW_NORMAL
FW_REGULAR
FW_MEDIUM
FW_SEMIBOLD
FW_DEMIBOLD
FW_BOLD
FW_EXTRABOLD
FW_ULTRABOLD
FW_BLACK
FW_HEAVY
0
100
200
200
300
400
400
500
600
600
700
800
800
900
900
tmltalic
tmUnderlined
tmStruckOut
tmFirstChar
tmLastChar
tm DefaultChar
tmBreakChar
Chapter 7, Structures
609
NEWTEXTMETRIC
tmPitchAndFamily
Meaning
TMPF_PITCH
TMPF_VECTOR
TMPF_TRUETYPE
TMPF_DEVICE
Meaning
FF_DECORATIVE
FF_DONTCARE
FF_MODERN
610
NEWTEXTMETRIC
Value
Meaning
tmOverhang
Value
ANSCCHARSET
DEFAULT_CHARSET
SYMBOL_CHARSET
SHIFfJIS_CHARSET
OEM_CHARSET
0
1
2
128
255
tmDigitizedAspectX
tmDigitizedAspectV
Chapter 7, Structures
611
NFYLOADSEG
ntmFlags
Comments
See Also
ntmSizeEM
ntmCeliHeight
ntmAvgWidth
NFYLOADSEG
3.1
The NFYLOADSEG structure contains information about the segment
being loaded when the kernel sends a load-segment notification.
#include <toolhelp.h>
typedef struct tagNFYLOADSEG {
DWORD
dwSize;
WORD
wSelectori
WORD
wSegNuffii
WORD
wTypei
WORD
wclnstancei
LPCSTR IpstrModuleNamei
} NFYLOADSEG i
612
/* nfyls */
NFYLOGERROR
TNFYLoadSeg = record
dwSize: Longint;
wSelector: Word;
wSegNum: Word;
wType: Word;
hInstance: THandle;
lpstrModuleName: PChar;
end;
Members
dwSize
wSelector
wSegNum
wType
Meaning
See Also
wclnstance
IpstrModuleName
NotifyRegister
3.1
NFYLOGERROR
Chapter 7, Structures
/* nfyle */
613
NFYLOGPARAMERROR
TNFYLogError=record
dwSize: Longint;
wErrCode: Word;
Iplnfo: PChar;
end;
Members
dwSize
wErrCode
Iplnfo
See Also
{ Error code-dependent }
NotifyRegister
NFYLOGPARAM ERROR
3.1
/* nfylpe */
TNFYLogParamError=record
dwSize: Longint;
wErrCode: Word;
IpfnErrorAddr : TFarProc;
IpBadParam: PChar;
end;
Members
See Also
614
dwSize
wErrCode
IpfnErrorAddr
IpBadParam
NotifyRegister
NFYRIP
NFYRIP
3.1
The NFYRIP structure contains information about the system when a
system debugging error (RIP) occurs.
#include <toolhelp.h>
typedef struct tagNFYRIP {
DWORD dwSize;
WORD wIP;
WORD wCS;
WORD wSS;
WORD wBP;
WORD wExitCode;
NFYRIP;
/* nfyr */
TNFYRi P = record
dwSize: Longint;
wIP: Word;
wCS: Word;
wSS: Word;
wBP: Word;
wExitCode :Word;
end;
Members
dwSize
wlP
wCS
wSS
wBP
wExitCode
Comments
See Also
Chapter 7, Structures
615
NFYSTARTDLL
NFYSTARTDLL
3.'
The NFYSTARTDLL structure contains information about the
dynamic-link library (DLL) being loaded when the kernel sends a
load-DLL notification.
#include <toolhelp.h>
typedef struct tagNFYSTARTDLL {
DWORD
dwSize;
HMODULE hModul e;
WORD
wCS;
WORD
wIP;
NFYSTARTDLL;
/* nfysd */
TNFYStartDLL = record
dwSize: Longint;
hModule: THandle;
wCS: Word;
wIP: Word;
end;
Members
dwSize
hModule
wCS
wlP
See Also
616
NotifyRegister
OLECLlENMBL
OLECLIENT
3.'
The OLECLIENT structure points to an OLECLlENTVTBL structure and
can store state information for use by the client application.
#include <ole.h>
typedef struct _OLECLIENT { /* oc */
LPOLECLIENTVTBL lpvtbl;
/* any client-supplied state information */
OLECLIENT;
TOleClient = record
lpvtbl: POleClientVTBL;
end;
Members
Comments
Ipvtbl
Servers and object handlers should not attempt to use any state
information supplied in the OLECLIENT structure. The use and meaning
of this information is entirely dependent on the client application.
Because a pointer to this structure is supplied as a parameter to the
client's callback function, this is the preferred method for the client
application to store private object-state information.
OLECLlENTVTBL
3.'
TOleClientVTbl = record
CallBack: function (Client: POleClient; Nofication: TOle_Notification;
OleObject: POleObject): Integer;
end;
Chapter 7, Structures
617
OLECLlENMBL
Comments
Function
Syntax
The address passed as the CallBack member must be created by using the
MakeProclnstance function.
ClientCaliback
INT ClientCallback(lpclient, notification, lpobject)
The ClientCaliback function must use the Pascal calling convention and
must be declared FAR.
Parameters
lpclient
notification
Meaning
618
OLECLlENMBL
Value
Meaning
Ipobject
Return Value
When the notification parameter specifies either OLE_QUERY_PAINT or
OLE_QUERY_RETRY, the client should return TRUE if the library should
continue, or FALSE to terminate the painting operation or discontinue the
server transaction. When the notification parameter does not specify either
OLE_QUERY_PAINT or OLE_QUERY_RETRY, the return value is
ignored.
Chapter 7, Structures
619
OLEOBJECT
Comments
The client application should act on these notifications at the next
appropriate time; for example, as part of the main event loop or when
closing the object. The updating of an object can be deferred until the user
requests the update, if the client provides that functionality. The client
may call the library from a notification callback function (the library is
reentrant). The client should not attempt an asynchronous operation
while certain other operations are in progress (for example, opening or
deleting an object). The client also should not enter a message-dispatch
loop inside the callback function. When the client application calls a
function that would cause an asynchronous operation, the client library
returns OLE_WAIT_FOR_RELEASE when the function is called, notifies
the application when the operation completes by using OLE_RELEASE,
and returns OLE_BUSY if the client attempts to invoke a conflicting
operation while the previous one is in progress. The client can determine
if an asynchronous operation is in progress by calling
OleQueryReleaseStatus, which returns OLE_BUSY if the operation has
not yet completed.
See Also
OleQueryReleaseStatus
3.1
OLEOBJECT
The OLEOBJECT structure points to a table of function pointers for an
object. This structure is initialized and maintained by servers for the
server library.
#include <ole.h>
typedef struct _OLEOBJECT
LPOLEOBJECTVTBL lpvtbl;
/*
00
*/
} OLEOBJECT;
TOleObject = record
lpvtbl: POleObjectVTbl;
end;
Members
620
Ipvtbl
OLEOBJECMBL
3.1
OLEOBJECTVTBL
Chapter 7, Structures
621
OLEOBJECMBL
TOleObjectVTbl=record
QueryProtocol: function (Self: POleObject; Protocol: PChar):
Pointer;
Release: function (Self: POleObject): TOleStatus;
Show: function (Self: POleObject; TakeFocus: Bool): TOleStatus;
DoVerb: function (Self: POleObject; Verb: Word; Show, Focus: Bool):
TOleStatus;
GetData: function (Self: POleObject; Format: TOleClipFormat;
var Handle: THandle): TOleStatus;
SetData: function (Self: POleObject; Format: TOleClipFormat;
Data: THandle): TOleStatus;
SetTargetDevice: function (Self: POleObject;
TargetDevice: THandle): TOleStatus;
SetBounds: function (Self: POleObject; var Bounds: TRect):
TOleStatus;
EnumFormats: function (Self: POleObject;
Format: TOleClipFormat): TOleClipFormat;
SetColorScheme: function (Self: POleObject; var Palette:
TLogPalette): TOleStatus;
Server has to implement only the above methods.
Extra methods required for client.
Delete: function (Self: POleObject): TOleStatus;
SetHostNames: function (Self: POleObject; Client,
ClientObj: PChar): TOleStatus;
SaveToStream: function (Self: POleObject; Stream: POleStream):
TOleStatus;
Clone: function (Self: POleObject; Client: POleClient;
ClientDoc: LHClientDoc; ObjectName: PChar;
var OleObject: POleObject): TOleStatus;
CopyFromLink: function (Self: POleObject; Client: POleClient;
ClientDoc: LHClientDoc; ObjName: PChar;
var OleObject: POleObject): TOleStatus;
Equal: function (Self: POleObject; OleObject: POleObject):
TOleStatus;
CopyToClipboard: function (Self: POleObject): TOleStatus;
Draw: function (Self: POleObject; DC: HDC; var Bounds, WBounds:
TRect; FormatDC: HDC): TOleStatus;
Activate: function (Self: POleObject; Verb: Word; Show, TakeFocus:
Bool; hWnd: HWnd; Bounds: PRect): TOleStatus;
Execute: function (Self: POleObject; Commands: THandle;
Reserved: Word): TOleStatus;
Close: function (Self: POleObject): TOleStatus;
Update: function (Self: POleObject): TOleStatus;
Reconnect: function (Self: POleObject): TOleStatus;
622
OLEOBJECMBL
Chapter 7, Structures
623
OLEOBJECMBL
Comments
Function
Syntax
SetBounds
SetCol0I5cheme
SetData
SetHostNames
SetLinkUpdateOptions
SetTargetDevice
Show
Update
Release
OLE STATUS (FAR PASCAL *Release)(lpObject)
The Release function causes the server to free the resources associated
with the specified OLEOBJECT structure.
Parameters
IpObject
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The server application should not destroy data when the library calls the
Release function. The library calls the Release function when no clients
are connected to the object.
Function
Syntax
Show
OLE STATUS (FAR PASCAL *Show)(lpObject, ITakeFocus)
function Show(Self: POleObject; TakeFocus: Bool): TOleStatus;
The Show function causes the server to show an object, displaying its
window and scrolling (if necessary) to make the object visible.
Parameters
IpObject
fTakeFocus
624
OLEOBJECMBL
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The library calls the Show function when the server application should
show the document to the user for editing or to request the server to scroll
the document to bring the object into view.
Function
Syntax
DoVerb
OLE STATUS (FAR PASCAL *DoVerb)(lpObject, iVerb, fShow,
fTakeFocus)
The DoVerb function specifies what kind of action the server should take
when a user activates an object.
Parameters
IpObject
iVerb
fShow
[fakeFocus
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
All servers must support the editing of objects. If a server does not
support any verbs except Edit, it should edit the object no matter what
value is specified by the iVerb parameter.
Function
Syntax
Get Data
OLE STATUS (FAR PASCAL *GetData)(lpObject, cfFormat,lphdata)
Chapter 7, Structures
625
OLEOBJECMBL
Parameters
IpObject
cfFormat
Iphdata
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value, which may be one of the following:
OLE_ERROR_BLANK
OLE_ERROR_FORMAT
OLE_ERROR_OBJECT
Function
Syntax
SetData
OLE STATUS (FAR PASCAL *SetData)OpObject, cfFormat, hdata)
The Set Data function stores data in an object in a specified format. This
function is called (with the Native data format) when a client opens an
embedded object for editing. This function is also used if the client calls
the OleSetData function with some other format.
Parameters
IpObject
cfFormat
hdata
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
626
OLEOBJECMBL
Comments
The server application is responsible for the memory identified by the
hdata parameter. The server must delete this data even if it returns
OLE_BUSY or if an error occurs.
Function
Syntax
SetTargetDevice
OLESTA TUS (FAR PASCAL *SetTargetDevice)OpObject, hotd)
The SetTargetDevice function communicates information about the
client's target device for the object. The server can use this information to
customize output for the target device.
Parameters
IpObject
hotd
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The server application is responsible for the memory identified by the
hotd parameter. The server must delete this data even if it returns
OLE_BUSY or if an error occurs.
The library passes NULL for the hotd parameter to indicate that the
rendering is necessary for the screen.
See Also
OleSetTargetDevice
Function
Syntax
ObjectLong
OLESTATUS (FAR PASCAL *ObjectLong)OpObject, wFlags,lpData)
The ObjectLong function allows the calling application to store data with
an object. This function is typically used by object handlers.
Parameters
IpObject
Chapter 7, Structures
627
OLEOBJECMBL
wFlags
Meaning
lpData
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Function
Syntax
SetColorScheme
OLESTATUS SetColorScheme(lpObject,lpPal)
The SetColorScheme function sends the server application the color
palette recommended by the client application.
Parameters
lpObject
lpPal
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
628
OLESERVER
Comments
Server applications are not required to use the palette recommended by
the client application.
Before returning from the SetColorScheme function, the server
application should use the palette pointed to by the IpPal parameter in a
call to the CreatePalette function to create the handle of the palette:
hpal=CreatePalette(lpPal) ;
The server can then use the palette handle to refer to the palette.
The first palette entry in the LOGPALETTE structure specifies the
foreground color recommended by the client application. The second
palette entry specifies the background color. The first half of the
remaining palette entries are fill colors, and the second half are colors for
lines and text.
Client applications typically specify an even number of palette entries.
When there is an uneven number of entries, the server should interpret
the odd entry as a fill color; that is, if there are five entries, three should be
interpreted as fill colors and two as line and text colors.
3.1
OLESERVER
/* os */
OLESERVER;
TOleServer = record
lpvtbl: POleServerVTbl;
end;
Members
Ipvtbl
Chapter 7, Structures
629
OLESERVERDOCVTBL
OLESERVERDOC
3.1
/* osd */
TOleServerDoc = record
lpvtbl: POleServerDocVTbl;
end;
Members
Ipvtbl
OLESERVERDOCVTBL
3.1
630
OLESERVERDOCVTBL
TOleServerDocVTbl=record
Save: function (Doc: POleServerDoc): TOleStatusi
Close: function (Doc: POleServerDoc): TOleStatusi
SetHostNames: function (Doc: POleServerDoc; Client, Doc: PChar):
TOleStatusi
SetDocDimensions: function (Doc: POleServerDoc;
var Bounds: TRect): TOleStatus;
GetObject: function (Doc: POleServerDoci Item: PChar;
var OleObject: POleObject; Client: POleClient): TOleStatus;
Release: function (Doc: POleServerDoc): TOleStatusi
SetColorScheme: function (Doc: POleServerDoc;
var Palette: TLogPalette): TOleStatus;
Execute: function (Doc: POleServerDoc; Commands: THandle):
TOleStatus;
end;
Save
OLESTATUS Save(lpDoc)
The Save function instructs the server to save the document.
Parameters
IpDoc
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Function
Syntax
Close
OLE STATUS Close(lpDoc)
The Close function instructs the server application to unconditionally
close the document. The library calls this function when the client
application initiates the closure.
Parameters
IpDoc
Chapter 7, Structures
631
OLESERVERDOCVTBL
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The library always calls the Close function before calling the Release
function in the OLESERVERVTBL structure.
The server application should not prompt the user to save the document
or take other actions; messages of this kind are handled by the client
application.
When the library calls the Close function, the server should respond by
calling the OleRevokeServerDoc function. The resources for the
document are freed when the library calls the Release function. The
server should not wait for the Release function by entering a
message-dispatch loop after calling OleRevokeServerDoc. (A server
should never enter message-dispatch loops while processing any of these
functions.)
When a document is closed, the server should free the memory for the
OLESERVERDOCVTBL structure and associated resources.
Function
Syntax
SetHostNames
OLE STATUS SetHostNames(lpDoc, IpszClient,lpszDoc)
The SetHostNames function sets the name that should be used for a
window title. This name is used only for an embedded object, because a
linked object has its own title. This function is used only for documents
that are embedded objects.
Parameters
632
IpDoc
IpszClient
IpszDoc
OLESERVERDOCVTBL
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Function
Syntax
SetDocDimensions
OLESTATUS SetDocDimensions(lpDoc, IpRect)
The SetDocDimensions function gives the server the rectangle on the
target device for which the object should be formatted. This function is
relevant only for documents that are embedded objects.
Parameters
IpDoc
IpRect
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Function
Syntax
GetObject
OLESTATUS GetObject(lpDoc,lpszltem,lplpObject, IpClient)
The GetObject function requests the server to create an OLEOBJECT
structure.
Parameters
IpDoc
IpszItem
IplpObject
Chapter 7, Structures
633
OLESERVERDOCVTBL
IpClient
Retum Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The server application should allocate and initialize the OLEOBJECT
structure, associate it with the OLECLIENT structure pointed to by the
IpClient parameter, and return a pointer to the OLEOBJECT structure
through the IplpObject argument.
The library calls the GetObject function to associate a client with the part
of the document identified by the IpszItem parameter. When a client has
been associated with an object by this function, the server can send
notifications to the client.
Applications should be prepared to handle multiple calls to GetObject for
a given object. This entails creating multiple OLECLIENT structures and
sending notifications to each of these structures when appropriate.
Multiple calls to GetObject are possible because some client applications
that implement object linking and embedding (OLE) by using dynamic
data exchange (DDE) rather than the OLE dynamic-link libraries may use
both NULL and an actual item name for the IpszItem parameter.
Function
Syntax
Release
OLESTATUS Release(lpDoc)
The Release function notifies the server when a revoked document has
terminated conversations and can be destroyed.
Parameters
IpDoc
Retum Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
634
OLESERVERDOCVTBL
Function
Syntax
SetColorScheme
OLESTATUS SetColorScheme(lpDoc,lpPal)
The SetColorScheme function sends the server application the color
. palette recommended by the client application.
Parameters
IpDoc
IpPal
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
Server applications are not required to use the palette recommended by
the client application.
Before returning from the SetColorScheme function, the server
application should create a handle to the palette. To do this, the server
application should use the palette pointed to by the IpPal parameter in a
call to the CreatePalette function, as shown in the following example.
hpal=CreatePalette(lpPal) ;
The server can then use the palette handle to refer to the palette.
The first palette entry in the LOGPALETIE structure specifies the
foreground color recommended by the client application. The second
palette entry specifies the background color. The first half of the
remaining palette entries are fill colors, and the second half are colors for
lines and text.
Client applications typically specify an even number of palette entries.
When there is an uneven number of entries, the server should interpret
the odd entry as a fill color; that is, if there are five entries, three should be
interpreted as fill colors and two as line and text colors.
Chapter 7, Structures
635
OLESERVERVTBL
Function
Syntax
Execute
OLESTATUS Execute(lpDoc, hCommands)
The Execute function receives WM_DDE_EXECUTE commands sent by
client applications. The applications send these commands by calling the
OleExecute function.
Parameters
IpDoc
hCommands
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The server should never free the handle specified in the hCommands
parameter.
3.1
OLESERVERVTBL
636
OLESERVERVTBL
TOleServerVTbl=record
Open: function (Server: POleServeri Doc: LHServerDoci DocName: PChari
var ServerDoc: POleServerDoc): TOleStatusi
Create: function (Server: POleServeri Doc: LHServerDoci Class,
DocName: PChari var ServerDoc: POleServerDoc): TOleStatusi
CreateFromTemplate: function (Server: POleServeri Doc: LHServerDoci
Class, DocName, TemplateName: PChari var ServerDoc: POleServerDoc):
TOleStatus i
Edit: function (Server: POleServeri Doc: LHServerDoci Class,
DocName: PChari var ServerDoc: POleServerDoc): TOleStatusi
Exit: function (Server: POle Server) : TOleStatusi
Release: function (Server: POleServer): TOleStatusi
Execute: function (Server: POleServeri Commands: THandle): TOleStatusi
end;
Open
OLE STATUS Open(lpServer, IhDoc, IpszDoc, IplpDoc)
The Open function opens an existing file and prepares to edit the
contents. A server typically uses this function to open a linked object for a
client application.
Parameters
lpServer
lhDoc
lpszDoc
lplpDoc
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
When the library calls this function, the server application opens a
specified document, allocates and initializes an OLESERVERDOC
structure, associates the library's handle with the document, and returns
Chapter 7, Structures
637
OLESERVERVTBL
the address of the structure. The server does not show the document or its
window.
Function
Syntax
Create
OLESTATUS CreateOpServer,lhDoc,lpszClass,lpszDoc,lplpDoc)
The Create function makes a new object that is to be embedded in the
client application. The IpszDoc parameter identifies the object but should
not be used to create a file for the object.
Parameters
IpSe rver
IhDoc
IpszClass
IpszDoc
IplpDoc
Retum Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
When the library calls this function, the server application creates a
document of a specified class, allocates and initializes an
OLESERVERDOC structure, associates the library's handle with the
document, and returns the address of the structure. This function opens
the created document for editing and embeds it in the client when it is
updated or closed.
Server applications often track changes to the document specified in this
function, so that the user can be prompted to save changes when
necessary.
638
OLESERVERVTBL
Function
Syntax
CreateFromTemplate
OLESTATUS CreateFromTemplateOpServer, IhDoc, IpszClass, IpszDoc,
IpszTemplate,lplpDoc)
The CreateFromTemplate function creates a new document that is
initialized with the data in a specified file. The new document is opened
for editing by this function and embedded in the client when it is updated
or closed.
Parameters
IpServer
IhDoc
IpszClass
IpszDoc
lpsz Templa te
IplpDoc
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
When the library calls this function, the server application creates a
document of a specified class, allocates and initializes an
OLESERVERDOC structure, associates the library's handle with the
document, and returns the address of the structure.
A server application often tracks changes to the document specified in
this function, so that the user can be prompted to save changes when
necessary.
Chapter 7, Structures
639
OLESERVERVTBL
Function
Syntax
Edit
OLE STATUS Edit(lpServer, IhDoc,lpszClass,lpszDoc,lplpDoc)
The Edit function creates a document that is initialized with data
retrieved by a subsequent call to the Set Data function. The object is
embedded in the client application. The server does not show the
document or its window.
Parameters
lpServer
lhDac
lpszClass
lpszDac
lplpDac
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
When the library calls this function, the server application creates a
document of a specified class, allocates and initializes an
OLESERVERDOC structure, associates the library's handle with the
document, and returns the address of the structure.
The document created by the Edit function retrieves the initial data from
the client in a subsequent call to the Set Data function. The user can edit
the document after the data has been retrieved and the library has used
either the Show function in the OLEOBJECTVTBL structure or the
DoVerb function with an Edit verb to show the document to the user.
640
OLESERVERVTBL
Function
Syntax
Exit
OLESTATUS Exit(lpServer)
The Exit function instructs the server application to close documents and
quit.
Parameters
IpServer
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The server library calls the Exit function to instruct a server application to
terminate. If the server application has no open documents when the Exit
function is called, it should call the OleRevokeServer function.
Function
Syntax
Release
OLESTATUS ReleaseOpServer)
The Release function notifies a server that all connections to it have
closed and that it is safe to quit.
Parameters
IpServer
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The server library calls the Release function when it is safe for a server to
quit. When a server application calls the OleRevokeServer function, the
application must continue to dispatch messages and wait for the library to
call the Release function before quitting.
When the server is invisible and the library calls Release, the server must
exit. (The only exception is when an application supports multiple
servers; in this case, an invisible server is sometimes not revocable when
the library calls Release.) If the server has no open documents and it was
Chapter 7, Structures
641
OLESERVERVTBL
Execute
OLE STATUS Execute(lpServer, hCommands}
The Execute function receives WM_OOE_EXECUTE commands sent by
client applications. The applications send these commands by calling the
Ole Execute function.
Parameters
IpServer
hCommands
Return Value
The return value is OLE_OK if the function is successful. Otherwise, it is
an error value.
Comments
The server should never free the handle specified in the hCommands
parameter.
642
OLESTREAMVTBL
3.1
OLESTREAM
/* ostr */
TOleStrearn = record
lpstbl: POleStreamVTbl;
end;
Members
Ipstbl
3.1
OLESTREAMVTBL
The OLESTREAMVTBL structure points to functions the client library
uses for stream operations on objects. This structure is allocated and
initialized by client applications.
#include <ole.h>
typedef struct _OLESTREAMVTBL
/* ostrv */
DWORD (CALLBACK* Get) (LPOLESTREAM, void FAR*, DWORD);
DWORD (CALLBACK* Put) (LPOLESTREAM, OLE_CONST void FAR*, DWORD);
} OLESTREAMVTBL;
TOleStrearnVTbl = record
Get: function (Stream: POleStrearn; Buffer: PChari Size: Longint) :
Longint;
Put: function (Stream: POleStrearni Buffer: PChari Size: Longint) :
Longinti
end;
Comments
The stream is valid only for the duration of the function to which it is
passed. The library obtains everything it requires while the stream is valid.
The return values for the stream functions may indicate that an error has
occurred, but these values do not indicate the nature of the error. The
Chapter 7, Structures
643
OLESTREAMVTBL
Get
DWORD Get(lpstream, IpszBuf, cbbuf)
The Get function gets data from the specified stream.
Parameters
Ipstream
IpszBuf
cbbuf
Return Value
The return value is the number of bytes actually read into the buffer if the
function is successful. If the end of the file is encountered, the return
value is zero. A negative return value indicates that an error occurred.
Comments
The value specified by the cbbuf parameter can be larger than 64K. If the
client application uses a stream-reading function that is limited to 64K, it
should call that function repeatedly until it has read the number of bytes
specified by cbbuf. Whenever the data size is larger than 64K, the pointer
to the data buffer is always at the beginning of the segment.
Function
Syntax
Put
DWORD Put(lpstream, IpszBuf, cbbuf)
The Put function puts data into the specified stream.
Parameters
Ipstream
IpszBuf
cbbuf
644
OLETARGETDEVICE
Return Value
The return value is the number of bytes actually written to the stream. A
return value less than the number specified in the cbbuf parameter
indicates that either there was insufficient space in the stream or an error
occurred.
Comments
The value specified by the cbbuf parameter can be greater than 64K. If the
client application uses a stream-writing function that is limited to 64K, it
should call that function repeatedly until it has written the number of
bytes specified by cbbuf. Whenever the data size is greater than 64K, the
pointer to the data buffer is always at the beginning of the segment.
OLETARGETDEVICE
3.1
TOleTargetDevice = record
otdDeviceNameOffset: Word;
otdDriverNameOffset: Word;
otdPortNameOffset: Word;
otdExtDevrnodeOffset: Word;
otdExtDevrnodeSize: Word;
otdEnvironmentOffset: Word;
otdEnvironmentSize: Word;
otdData: array[O .. O] of Byte;
end;
Chapter 7, Structures
645
OPENFILENAME
Members
otdDeviceNameOffset
otdDriverNameOffset
otdPortNameOffset
otdExtDevmodeOffset
otdExtDevmodeSize
otdEnvironmentOffset
Comments
otdEnvironmentSize
otdData
See Also
OleSetTargetDevice
OPENFILENAME
3.1
646
OPEN FILENAME
#include <commdlg.h>
typedef struct tagOPENFILENAME { /* ofn */
DWORD
lStructSizei
HWND
hwndOwner i
HINSTANCE hInstancei
LPCSTR
lpstrFilteri
LPSTR
lpstrCustomFilteri
DWORD
nMaxCustFilteri
DWORD
nFilterIndeXi
LPSTR
lpstrFilei
DWORD
nMaxFilei
LPSTR
lpstrFileTitle;
DWORD
nMaxFileTitle;
LPCSTR
lpstrInitialDir;
LPCSTR
lpstrTitlei
DWORD
Flags;
UINT
nFileOffseti
UINT
nFileExtensioni
LPCSTR
lpstrDefExti
LPARAM
lCustDatai
OINT
(CALLBACK *lpfnHook) (HWND, OINT, WPARAM, LPARAM) i
LPCSTR
lpTemplateNamei
OPENFILENAMEi
TOpenFilename = record
lStructSize: Longinti
hWndOwner: HWndi
hInstance: THandlei
lpstrFilter: PChari
lpstrCustomFilter: PChari
nMaxCustFilter: Longinti
nFilterIndex: Longinti
lpstrFile: PChari
nMaxFile: Longinti
lpstrFileTitle: PChari
nMaxFileTitle: Longinti
lpstrInitialDir: PChari
lpstrTitle: PChari
Flags: Longinti
nFileOffset: Wordi
nFileExtension: Wordi
lpstrDefExt: PChari
lCustData: Longinti
lpfnHook: function (Wnd: HWndi Msg, wParam: Wordi lParam: Longint):
Word;
lpTemplateName: PChari
end;
Members
IStructSize
hwndOwner
Chapter 7, Structures
647
OPENFILENAME
IpstrFilter
IpstrCustomFilter
nM axCustFilter
648
OPENFILENAME
IpstrFile
nMaxFile
Chapter 7, Structures
649
OPENFILENAME
IpstrFileTitle
nMaxFileTitle
Ipstrlnitial Dir
IpstrTitle
Flags
650
Value
Meaning
OFN_ALLOWMULTISELECT
OPEN FILENAME
Value
Meaning
OFN_CREATEPROMPT
OFN_ENABLEHOOK
OFN_ENABLETEMPLATE
OFN_ENABLETEMPLATEHANDLE
OFN_EXTENSIONDIFFERENT
OFN_FILEMUSTEXIST
OFN_HIDEREADONLY
OFN_NOCHANGEDIR
OFN_NOREADONLYRETURN
Chapter 7, Structures
651
OPEN FILENAME
Value
Meaning
OFN_NOTESTFILECREATE
OFN_NOVALIDATE
OFN_OVERWRITEPROMPT
OFN_PATHMUSTEXIST
652
OPEN FILENAME
Value
Meaning
OFN_READONLY
OFN_SHAREAWARE
Value
Meaning
nFileExtension
Chapter 7, Structures
653
OPENFILENAME
ICustData
IpfnHook
IpTemplateName
654
OUTLINETEXTMETRIC
member is ignored.
This member is filled on input.
See Also
GetOpenFileName, GetSaveFileName
OUTLINETEXTMETRIC
3.1
Chapter 7, Structures
655
OUTLINETEXTMETRIC
TOutlineTextMetric=record
otmSize: Word;
I size of this structure
otmTextMetrics: TTextMetric;
regular text metrics
otmFiller: Byte;
want to be word aligned
otmPanoseNumber: TPanose;
Panose number of font
otmfsSelection: Word;
B Font selection flags (see #defines)
otmfsType: Word;
B Type indicators
(see #defines)
otmsCharSlopeRise: Word;
Slope angle Rise / Run
1 vertical
otmsCharSlopeRun: Word;
0 vertical
otmEMSquare: Word;
N size of EM
otmAscent: Word;
D ascent above baseline
otmDescent: Word;
D descent below baseline
otmLineGap: Word;
D
otmCapEmHeight: Word;
D height of upper case M
otrnXHeight: Word;
D height of lower case chars in font
otmrcFontBox: TRect;
D Font bounding box
otmMacAscent: Word;
D ascent above baseline for Mac
otmMacDescent: Word;
D descent below baseline for Mac
otmMacLineGap: Word;
D
otmusMinimumPPEM: Word;
D Minimum point ppem
otmptSubscriptSize: TPoint;
D Size of subscript
otmptSubscriptOffset: TPoint;
D Offset of subscript
otmptSuperscriptSize: TPoint;
D Size of superscript
otmptSuperscriptOffset: TPoint;{ D Offset of superscript
otmsStrikeoutSize: Word;
{ D Strikeout size
otmsStrikeoutPosition: Word; {D Strikeout position
otmsUnderscoreSize: Word;
{ D Underscore size
otmsUnderscorePosition: Word; { D Underscore position
otmpFamilyName: PChar;
{ offset to family name
otmpFaceName: PChar;
{ offset to face name
otmpStyleName: PChar;
{ offset to Style string
otmpFullName: PChar;
{ offset to full name
end;
Members
otmSize
otmTextMetrics
otmFiller
otmPanoseNumber
otmfsSelection
Meaning
Italic
Underscore
Negative
Outline
Strikeout
Bold
1
2
3
4
656
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
OUTLINETEXTMETRIC
otmfsType
otmsCharSlopeRise
otmsCharSlopeRun
otmltalicAngle
otmEMSquare
otmAscent
otmDescent
otmLineGap
otmsXHeight
Not supported.
Not supported.
Specifies the bounding box for the font.
otmsCapEmHeight
otmrcFontBox
otmMacAscent
Chapter 7, Structures
657
OUTLINETEXTMETRIC
otmMacDescent
otmMacLineGap
otmusMinimumPPEM
otmptSubscriptSize
otmptSubscriptOffset
otmptSuperscriptSize
otmptSuperscriptOffset
otmsStrikeoutSize
otmsStrikeoutPosition
otmpFam ilyName
otmpFaceName
otmpStyleName
658
PANOSE
otmpFullName
Comments
See Also
PANOSE
3.1
The PANOSE structure describes the Panose font-classification values for
a TrueType font.
typedef struct tagPANOSE
BYTE bFamilyType;
BYTE bSerifStyle;
BYTE bWeight;
BYTE bProportion;
BYTE bContrast;
BYTE bStrokeVariation;
BYTE bAnnStyle;
BYTE bLetterform;
BYTE bMidline;
BYTE bXHeight;
PANOSE;
/* panose */
TPanose = record
bFamilyType: Byte;
bSerifStyle: Byte;
bWeight: Byte;
bProportion: Byte;
bContrast: Byte;
bStrokeVariation: Byte;
bArmStyle: Byte;
bLetterform: Byte;
bMidline: Byte;
bXHeight: Byte;
end;
Chapter 7, Structures
659
PANOSE
Members
bFamilyType
Meaning
0
1
2
Any
No fit
Text and display
Script
Decorative
Pictorial
5
bSerifStyle
Meaning
0
1
2
3
4
5
Any
No fit
Cove
Obtuse cove
Square cove
Obtuse square cove
Square
Thin
Bone
Exaggerated
Triangle
Normal sans
Obtuse sans
Perpsans
Flared
Rounded
6
7
8
9
10
11
12
13
14
15
bWeight
Meaning
Any
No fit
Very light
Light
Thin
Book
Medium
1
2
3
4
5
6
660
PANOSE
Value
Meaning
Demi
Bold
Heavy
Black
Nord
8
9
10
11
bProportion
Meaning
0
1
2
Any
No fit
Old style
Modern
Even width
Expanded
Condensed
Very expanded
Very condensed
Monospaced
3
4
5
6
7
8
9
bContrast
Meaning
0
1
2
3
4
Any
No fit
None
Very low
Low
Medium low
Medium
Medium high
High
Very high
5
6
7
8
9
Chapter 7, Structures
661
PANOSE
bStrokeVariation
Meaning
0
1
Any
No fit
Gradual/ diagonal
Grad ual / transi tional
Gradual/ vertical
Grad ual/ horizon tal
Rapid/ vertical
Rapid/horizontal
Instant/ vertical
2
3
4
5
6
7
8
bArmStyle
Meaning
0
1
Any
No fit
Straight arms/horizontal
Straight arms / wedge
Straight arms/vertical
Straight arms/ single serif
Straight arms/ double serif
N on-straight arms /horizontal
Non-straight arms/wedge
Non-straight arms/vertical
Non-straight arms/single serif
Non-straight arms/ double serif
2
3
4
5
6
7
8
9
10
11
bletterform
Meaning
Any
No fit
Normal/ contact
Normal/weighted
Normal/boxed
Normal/flattened
Normal/ rounded
Normal/off-center
1
2
3
4
5
6
7
662
PANOSE
Value
Meaning
8
9
N ormal/ square
Oblique/ contact
Oblique/ weighted
Oblique/boxed
Oblique/ flattened
Oblique/ rounded
Oblique/ off-center
Oblique/ square
10
11
12
13
14
15
bMidline
Meaning
0
1
2
3
4
5
Any
No fit
Standard/ trimmed
Standard/ pointed
Standard / serifed
High/ trimmed
High/ pointed
High/ serifed
Constant/ trimmed
Constant/ pointed
Constant/ serifed
Low /trimmed
Low / pointed
Low / serifed
6
7
8
9
10
11
12
13
bXHeight
Meaning
0
1
Any
No fit
Constant/ small
Constant/ standard
Constant/large
Ducking/ small
Ducking/ standard
Ducking/large
2
3
4
5
6
7
Chapter 7, Structures
663
PRINTDLG
3.1
POINTFX
TPointFX = record
x: TFixed;
y: TFixed;
end;
Members
y
See Also
3.1
PRINTDLG
664
*1
PRINTDLG
UINT
(CALLBACK* IpfnPrintHook) (HWND, UINT, WPARAM, LPARAM);
UINT
(CALLBACK* IpfnSetupHook) (HWND, UINT, WPARAM, LPARAM);
LPCSTR
IpPrintTemplateName;
LPCSTR
IpSetupTemplateName;
HGLOBAL
hPrintTemplate;
HGLOBAL
hSetupTemplate;
PRINTDLG;
TPrintDlg = record
lStructSize: Longint;
hWndOWner: HWnd;
hOevMode: THandle;
hOevNames: THandle;
hOC: HDC;
Flags: Longint;
nFromPage: Word;
nToPage: Word;
nMinPage: Word;
nMaxPage: Word;
nCopies: Word;
hInstance: THandle;
lCustData: Longint;
IpfnPrintHook: function (Wnd: HWnd; Msg, wParam: Word;
IParam: Longint): Integer;
IpfnSetupHook: function (Wnd: HWnd; Msg, wParam: Word;
IParam: Longint): Integer;
IpPrintTemplateName: PChar;
IpSetupTemplateName: PChar;
hPrintTemplate: THandle;
hSetupTemplate: THandle;
end;
Members
IStructSize
hwndOwner
Chapter 7, Structures
665
PRINTDLG
hDevNames
666
PRINTDLG
Flags
Value
Meaning
PD_ALLPAGES
PD_COLLATE
PD_DISABLEPRINTTOFILE
PD_ENABLEPRINTHOOK
PD_ENABLEPRINTTEMPLATE
Chapter 7, Structures
667
PRINTDLG
Value
Meaning
PD_ENABLEPRINTTEMPLATEHANDLE
PD_ENABLESETUPHOOK
PO_ENABLESETUPTEMPLATE
PO_ENABLESETUPTEMPLATEHANDLE
PO_HIDEPRINTTOFILE
PD_NOPAGENUMS
PO_NOSELECTION
PD_NOWARNING
PD_PAGENUMS
PO_PRINTTOFILE
668
PRINTDLG
Value
PD_RETURNDEFAULT
Chapter 7, Structures
Meaning
669
PRINTDLG
Value
Meaning
PD_USEDEVMODECOPIES
nFromPage
nToPage
nMinPage
nMaxPage
670
PRINTDLG
nCopies
hlnstance
ICustData
IpfnPrintHook
Chapter 7, Structures
671
PRINTDLG
IpfnSetupHook
IpPrintTemplateName
IpSetupTemplateName
hPrintTemplate
hSetupTemplate
See Also
672
SEGINFO
3. ,
RASTERIZER_STATUS
/* rs */
TRasterizer Status=record
nSize: Integer;
wFlags: Integer;
nLanguageID: Integer;
end;
Members
See Also
nSize
wFlags
nLanguagelD
GetRasterizerCaps
SEGINFO
3.'
The SEGINFO structure contains information about a data or code
segment. This structure is filled in by the GetCodelnfo function.
typedef struct tagSEGINFO
offSegrnent;
UINT
UINT
cbSegrnent;
UINT
flags;
UINT
cbAlloc;
HGLOBAL h;
UINT
alignShift;
UINT
reserved[2];
SEGINFO;
Chapter 7, Structures
673
SEGINFO
TSeglnfo = record
offSegment: Word;
cbSegment: Word;
flags: Word;
cbAlloc: Word;
h: THandle;
alignShift: Word;
reserved: array[O .. l] of Word;
end;
Members
offSegment
cbSegment
flags
Meaning
0-2
3
4
5-6
7
10-15
674
SIZE
See Also
ebAlloe
alignShift
reserved
GetCodelnfo
SIZE
3.1
The SIZE structure contains viewport extents, window extents, text
extents, bitmap dimensions, and the aspect-ratio filter for some extended
functions for Windows 3.1.
typedef struet tagSIZE
int ex;
int ey;
} SIZE;
TSize = record
eX: Integer;
eY: Integer;
end;
Members
See Also
ex
ey
Chapter 7, Structures
675
STACKTRACEENTRY
3.1
STACKTRACEENTRY
1* ste *1
TStackTraceEntry=record
dwSize: Longint;
hTask: THandle;
wSS: Word;
wBP: Word;
wCS: Word;
wIP: Word;
hModule: THandle;
wSegment: Word;
wFlags: Word;
end;
Members
dwSize
hTask
wSS
wBP
wCS
wlP
676
SYSHEAPINFO
hModule
wSegment
wFlags
See Also
Value
Meaning
FRAME_FAR
SYSHEAPINFO
3.1
The SYSHEAPINFO structure contains information about the USER and
GDI modules.
#include <toolhelp.h>
typedef struct tagSYSHEAPINFO {
DWORD
dwSize;
WORD
wUserFreePercent;
WORD
wGDIFreePercent;
HGLOBAL hUserSegment;
HGLOBAL hGDISegment;
SYSHEAPINFO;
/* shi */
TSysHeaplnfo = record
dwSize: Longint;
wUserFreePercent: Word;
wGDIFreePercent: Word;
hUserSegment: THandle;
hGDISegment: THandle;
end;
Members
dwSize
wUserFreePercent
wGDIFreePercent
hUserSegment
Chapter 7, Structures
677
TASKENTRV
hGDISegment
See Also
SystemHeaplnfo
TASKENTRY
3.1
The TASKENTRY structure contains information about one task.
#include <toolhelp.h>
typedef struct tagTASKENTRY
/* te */
DWORD
dwSize;
HTASK
hTask;
HTASK
hTaskParent;
HINSTANCE hlnst;
HMODULE
hModule;
WORD
wSS;
wSP;
WORD
WORD
wStackTop;
WORD
wStackMinimum;
WORD
wStackBottom;
WORD
wcEvents;
HGLOBAL
hQueue;
char
szModule[MAX_MODULE_NAME + 1];
WORD
wPSPOffset;
HANDLE
hNext;
TASKENTRY;
TTaskEntry = record
dwSize: Longint;
hTask: THandle;
hTaskParent: THandle;
hlnst: THandle;
hModule: THandle;
wSS: Word;
wSP: Word;
wStackTop: Word;
wStackMinimum: Word;
wStackBottom: Word;
wcEvents: Word;
hQueue: THandle;
szModule: array[O .. max_Module_Name] of Char;
wPSPOffset: Word;
hNext: THandle;
end;
Members
678
dwSize
hTask
TIMERINFO
hTaskParent
hlnst
hModule
wSS
wSP
wStackTop
wStackMinimum
wStackBottom
wcEvents
hQueue
szModule
wPSPOffset
hNext
See Also
TIMERINFO
3.1
The TIMERINFO structure contains the elapsed time since the current task
became active and since the virtual machine (VM) started.
#include <toolhelp.h>
typedef struct tagTlMERINFO {
DWORD dwSize;
DWORD dwmsSinceStart;
DWORD dwmsThisVM;
TlMERINFO;
Chapter 7, Structures
/* ti */
679
TTPOLYCURVE
TTirnerlnfo = record
dwSize: Longint;
dwmsSinceStart: Longint;
dwmsThisVM: Longint;
end;
Members
dwSize
dwmsSinceStart
dwmsThisVM
Comments
See Also
TIPOLYCURVE
3.1
The TTPOL YCURVE structure contains information about a curve in the
outline of a TrueType character.
typedef struct tagTTPOLYCURVE
UINT
wType;
UINT
cpfx;
POINTFX apfx[l);
TTPOLYCURVE;
TTTPolyCurve = record
wType: Word;
cpfx: Word;
apfx: array[O .. O) of TPointFX;
end;
Members
680
wType
Meaning
IT_PRIM_LINE
IT_PRIM_QSPLINE
Curve is a polyline.
Curve is a quadratic spline.
cpfx
apfx
TTPOLYGONHEADER
Comments
See Also
TIPOLYGONHEADER
3.1
TPolygonHeader=record
cb: Longint;
dwType: Longint;
pfxStart: TPointFX;
end;
Members
Comments
See Also
cb
dwType
pfxStart
Chapter 7, Structures
681
VS_FIXEDFILEINFO
VS_FIXEDFILEINFO
3.1
Tvs FixedFilelnfo=record
dwSignature: Longint;
dwStrucVersion: Longint;
dwFileVersionMS: Longint;
dwFileVersionLS: Longint;
dwProductVersionMS: Longint;
dwProductVersionLS: Longint;
dwFileFlagsMask: Longint;
dwFileFlags: Longint;
dwFileOS: Longint;
dwFileType: Longint;
dwFileSubtype: Longint;
dwFileDateMS: Longint;
dwFileDateLS: Longint;
/* vsffi */
e.g. $feef04bd }
e.g. $00000042
"0.42"
e.g. $00030075
"3.75"
e.g. $00000031
"0.31"
e.g. $00030010
"3.10"
e.g. $00000031
"0.31"
= $3F for version "0.42" }
e.g. vff_Debug I vff_Prerelease
{ e.g. vos_DOS_Windows16 }
e.g. vft DRIVER}
{ e. g.- vft2 _DRV_Keyboard
{ e.g. 0 }
{ e.g. 0 }
end;
Members
682
dwSignature
dwStrucVersion
dwFileVersionMS
VS_FIXEDFILEINFO
dwFileVersionLS
dwProductVersionMS
dwProductVersionLS
dwFileFlagsMask
dwFileFlags
Value
VS_FF_SPECIALBUILD
Chapter 7, Structures
Meaning
683
VS_FIXEDFILEINFO
dwFileOS
Value
Meaning
VOS_UNKNOWN
VOS_DOS
VOS_NT
VOS_WINDOWS16
VOS_WINDOWS32
VOS_DOS_WINDOWS16
VOS_NT_WINDOWS32
Value
Meaning
VFf_UNKNOWN
VFf_APP
VFf_DLL
VFf_DRV
VFf_FONT
VFf_VXD
VFf_STATIC_LIB
684
VS_FIXEDFILEINFO
Value
Meaning
VFf2_UNKNOWN
VFf2_DRV_COMM
VFf2_DRV_PRINTER
VFf2_DRV_KEYBOARD
VFf2_DRV_LANGUAGE
VFf2_DRV_DISPLAY
VFf2_DRV_MOUSE
VFf2_DRV_NETWORK
VFf2_DRV_SYSTEM
VFf2_DRV_INSTALLABLE
VFf2_DRV_SOUND
Meaning
VFf2_UNKNOWN
VFf2_FONT_RASTER
VFf2_FONT_VECTOR
VFf2_FONT_TRUETYPE
Comments
dwFileDateMS
dwFileDateLS
Chapter 7, Structures
685
WINDEBUGINFO
VerQueryValue
WINDEBUGINFO
3.1
TWinDebuglnfo = record
Flags: Word;
dwOptions: Longint;
dwFilter: Longint;
achAllocModule: array[O .. 7] of Char;
dwAllocBreak: Longint;
dwAllocCount: Longint;
end;
Members
686
flags
Value
Meaning
WDCOPTIONS
WDCFILTER
WDCALLOCBREAK
WINDEBUGINFO
dwOptions
Constant
Value
Meaning
DBa_CHECKHEAP
OxOOOl
DBa_BUFFERFILL
Ox0004
DBa_DISABLEGPTRAPPING
OxOOlO
DBa_CHECKFREE
Ox0020
DBa_INT3BREAK
OxOlOO
DBa_NOFATALBREAK
Ox0400
DBO_NOERRORBREAK
Ox0800
Chapter 7, Structures
687
WINDEBUGINFO
Constant
Value
Meaning
DBa_WARNING BREAK
OxlOOO
DBa_TRACE BREAK
Ox2000
DBa_SILENT
Ox8000
dwFilter
688
Constant
Value
Meaning
DBF_KRN_MEMMAN
OxOOOl
DBF_KRN_LOADMODULE
OxOOO2
DBF_KRN_SEGMENTLOAD
OxOOO4
DBF_APPLICATION
OxOOO8
DBF_DRIVER
OxOO1O
DBF_PENWIN
OxOO20
DBF_MMSYSTEM
OxOO40
DBF_GDI
Ox0400
DBF_USER
Ox0800
WINDEBUGINFO
Comments
Constant
Value
Meaning
DBF_KERNEL
Oxl000
achAllocModule
dwAllocBreak
dwAliocCount
See Also
Chapter 7, Structures
689
WINDOWPLACEMENT
3.1
WINDOWPLACEMENT
The WINDOWPLACEMENT structure contains information about the
placement of a window on the screen.
typedef struct tagWINDOWPLACEMENT
OINT length;
UINT flags;
OINT showCmd;
POINT ptMinPosition;
POINT ptMaxPosition;
RECT rcNormalPosition;
WINDOWPLACEMENT ;
/* wndpl */
TWindowPlacernent=record
length: Word;
flags: Word;
showCmd: Word;
ptMinPosition: TPoint;
ptMaxPosition: TPoint;
rcNormalPosition: TRect;
end;
Members
length
flags
Value
Meaning
WPF_SETMINPOSITION
WPF_RESTORETOMAXIMIZED
690
WINDOWPLACEMENT
showCmd
Value
SW_SHOWMINIMIZED
SW_SHOWMINNOACTIVE
SW_SHOWNOACTIVATE
SW_SHOWNORMAL
ptMinPosition
ptMaxPosition
rcNormalPosition
See Also
Chapter 7, Structures
691
WINDOWPOS
WIN DOWPOS
3.1
The WINDOWPOS structure contains information about the size and
position of a window.
typedef struet tagWINDOWPOS
HWND
hwnd;
HWND
hwndInsertAfter;
int
x;
int
y;
int
ex;
int
ey;
UINT
flags;
WINDOWPOS;
/*
wp
*/
TWindowPos = record
hWnd: HWnd;
hWndInsertAfter: HWnd;
x: Integer;
y: Integer;
ex: Integer;
ey: Integer;
flags: Word;
end;
Members
hwnd
hwndlnsertAfter
ex
ey
flags
Meaning
message.
692
WINDOWPOS
Value
Meaning
SWP_HIDEWINDOW
SWP_NOACTIVATE
SWP_NOMOVE
SWP_NOOWNERZORDER
SWP_NOSIZE
SWP_NOREDRAW
SWP_NOREPOSITION
SWP_NOZORDER
hwndlnsertAfter
SWP_SHOWWINDOW
See Also
member).
Displays the window.
EndDeferWindowPos
Chapter 7, Structures
693
694
8
Macros
DECLARE_HANDLE
Syntax
3.1
DECLARE_HANDLE(name)
The DECLARE_HANDLE macro creates a data type that can be used to
define 16-bit handles.
Parameters
name
Comments
See Also
DECLARE_HANDLE32
3.1
DECLARE_HANDLE32
Syntax
#include <ddeml.h>
DECLARE_HANDLE32(name)
The DECLARE_HANDLE32 macro creates a data type that can be used to
define 32-bit handles.
Parameters
Chapter 8, Macros
name
695
GetBValue
Parameters
name
Comments
See Also
DECLARE_HANDLE
FIELDOFFSET
Syntax
3. ,
int FIELDOFFSET(type, field)
The FIELDOFFSET macro computes the address offset of the specified
member in the structure specified by the type parameter.
Parameters
Return Value
Comments
type
field
The return value is the address offset of the given structure member.
The FIELDOFFSET macro is defined in WINDOWS.H as follows:
#define FIELDOFFSET(type, field)
3.'
GetBValue
Syntax
BYTE CetBValue(rgb)
The GetBValue macro extracts the intensity value of the blue color field
from the 32-bit integer value specified by the rgb parameter.
Parameters
rgb
Return Value
The return value specifies the intensity of the blue color field.
Comments
See Also
696
((BYTE) ((rgb>16
MAKELP
GetGValue
Syntax
3.1
BYTE GetGValue(rgb)
The GetGValue macro extracts the intensity value of the green color field
from the 32-bit integer value specified by the rgb parameter.
Parameters
Return Value
Comments
rgb
The return value specifies the intensity of the green color field.
The GetGValue macro is defined in WINDOWS.H as follows:
#define GetGValue (rgb)
See Also
8))
GetRValue
Syntax
3.1
BYTE GetRValue(rgb)
The GetRValue macro extracts the intensity value of the red color field
from the 32-bit integer value specified by the rgb parameter.
Parameters
Return Value
Comments
rgb
The return value specifies the intensity of the red color field.
The GetRValue macro is defined in WINDOWS.H as follows:
#define GetRValue (rgb)
See Also
((BYTE) (rgb) )
MAKELP
Syntax
3.1
void FAR* MAKELP( wSel, wOff)
The MAKELP macro combines a segment selector and an address offset to
create a long (32-bit) pointer to a memory address.
Parameters
Chapter 8, Macros
wSel
697
MAKELRESULT
woft
Return Value
Comments
See Also
(sel)))
MAKE LONG
MAKE LPARAM
Syntax
3.1
LPARAM MAKELPARAM(wLow, wHigh)
Return Value
Comments
wLow
wHigh
See Also
((LPARAM)MAKELONG(low, high))
MAKELONG, MAKELRESULT
MAKELRESULT
Syntax
3.1
LRESULTMAKELRESULT(wLow, wHigh)
The MAKELRESULT macro creates an unsigned long integer for use as a
return value from a window procedure. The macro concatenates two
integer values, specified by the wLow and wHigh parameters.
Parameters
Return Value
698
wLow
wHigh
SELECTOROF
Comments
See Also
((LRESULT)MAKELONG(low, high))
MAKELONG, MAKELPARAM
OFFSETOF
Syntax
3.1
WORD OFFSETOF(lp)
The OFFSETOF macro retrieves the address offset of the specified long
pointer.
Parameters
Return Value
Comments
Ip
See Also
LOWORD (lp)
LOWORD, SELECTOROF
SELECTOROF
Syntax
3.1
WORD SELECTOROF(lp)
The SELECTOROF macro retrieves the segment selector from the
specified long pointer.
Parameters
Return Value
Comments
Ip
See Also
Chapter 8, Macros
HIWORD(lp)
HIWORD,OFFSETOF
699
700
Printer escapes
MOUSETRAILS
Syntax
Parameters
hdc
IpTrailSize
Value
Meaning
1 through 7
Enables mouse trails and sets the trail size to the specified number.
A value of 1 requests a single mouse cursor. A value of 2 requests
that one extra mouse cursor be drawn behind the current mouse
cursor, and so on, up to a maximum of 7 total cursor images. The
escape sets the MouseTrails entry in the WIN.lNI file to the given
value and returns the new trail size.
Disables mouse trails. The escape sets the MouseTrails entry to the
negative value of the current trail size (if positive) and returns the
negative value.
701
Value
Meaning
-1
-2
-3
Return Value
The return value specifies the new trail size if the escape is successful. The
return value is zero if the escape is not supported.
POSTSCRIPT_DATA
The POSTSCRIPT_DATA printer escape is identical to the
PASSTHROUGH escape.
POSTSCRIPT_IGNORE
Syntax
Parameters
Return Value
Comments
702
hdc
IpfOutput
The return value specifies the previous setting of the output flag.
Applications that generate their own PostScript code can use the
POSTSCRIPT_IGNORE escape to prevent the PostScript device driver
from generating output.
SETALUUSTVALUES
Syntax
Parameters
Return Value
Comments
hdc
IplnData
The return value specifies the outcome of the escape. This value is 1 if the
escape is successful. Otherwise, it is zero.
The IplnData parameter points to an EXTTEXTDATA structure that
describes the text-justification values used for text output. The
EXTTEXTDATA structure has the following form:
typedef struct {
short nSizei
LPALLJUSTREC lplnDatai
LPFONTINFO lpFonti
LPTEXTXFORM lpXFormi
LPDRAWMODE lpDrawModei
EXTTEXTDATAi
703
cch
nBreakExtra
nBreakCount
The units used for the nCharExtra and nBreakExtra members are the font
units of the device and are dependent on whether relative character
widths were enabled with the ENABLERELATIVEWIDTHS escape.
The values set with this escape apply to subsequent calls to the TextOut
function. The driver stops distributing the extra space specified in the
nCharExtra member when it has output the number of characters
specified in the nCharCount member. Likewise, it stops distributing the
space specified by the nBreakExtra member when it has output the
number of characters specified by the nBreakCount member. A call on the
same string to the GetTextExtent function made immediately after the call
to the TextOut function will be processed in the same manner.
To reenable justification with the SetTextJustification and
SetTextCharacterExtra functions, an application should call the
SETALLJUSTVALUES escape and set the nCharExtra and nBreakExtra
members to zero.
704
10
3.1
#include <ddeml.h>
XTYP ADVDATA
hszTopic = hszl;
/* handle of topic-name string */
hszltem = hsz2;
/* handle of item-name string */
hDataAdvise = hData; /* handle of the advise data
*/
A client's DDE callback function can receive this transaction after the
client has established an advise loop with a server. This transaction
informs the client that the value of the data item has changed.
Parameters
hszTopic
hszItem
705
hDataAdvise
Return Value
Comments
See Also
XlYP~DVREQ
3.1
#include <ddeml.h>
XTYP_ADVREQ
hszTopic = hszl;
/* handle of topic-name string
*/
hszltem = hsz2i
/* handle of item-name string
*/
cAdvReq = LOWORD(dwDatal)i /* count of remaining transactions */
The system sends this transaction to a server after the server calls the
DdePostAdvise function. This transaction informs the server that an
advise transaction is outstanding on the specified topic/item name pair
and that data corresponding to the topic/ item name pair has changed.
Parameters
706
hszTopic
hszItem
cAdvReq
comments
A server cannot block this transaction type; the CBR_BLOCK return value
is ignored.
See Also
XlYP_A DVSTART
3.1
#include <ddeml.h>
XTYP ADVSTART
hszTopic = hszl;
hszltem = hsz2;
hszTopic
hszltem
Return Value
Comments
707
3.'
#include <ddeml.h>
XTYP ADVSTOP
hszTopic = hszl;
hszltem = hsz2;
Return Value
Comments
See Also
hszTopic
hszltem
3. ,
#include <ddeml.h>
XTYP CONNECT
hszTopic = hszl;
hszService = hsz2;
pcc = (CONVCONTEXT FAR *)dwDatal;
fSamelnst = (BOOL) dwData2;
/*
/*
/*
/*
*/
*/
*/
*/
708
hszTopic
hszServiee
pee
fSamelnst
Return Value
Comments
DdeConnect, Ddelnitialize
3.1
#include <ddernl.h>
XTYP - CONNECT- CONFIRM
hszTopic = hszl;
/* handle of topic-name string
*/
hszService = hsz2;
/* handle of service-name string */
fSameInst = (BOOL) dwData2; /* same instance flag
*/
hszTopie
709
XTYP_DISCONNECT
Return Value
Comments
hszService
[SameInst
A server cannot block this transaction type; the CBR_BLOCK return value
is ignored.
See Also
XlYP_DISCONNECT
3.1
#include <ddeml.h>
XTYP DISCONNECT
Return Value
Comments
710
[SameInst
DdeDisconnect, DdeQueryConvlnfo
#include <ddeml.h>
XTYP ERROR
wErr = LOWORD(dwDatal)i /* error value */
Return Value
Comments
wErr
XfYP_EXECUTE
3.1
#include <ddeml.h>
XTYP EXECUTE
hszTopic = hszli
hDataCmd = hDatai
711
Parameters
Return Value
Comments
hszTopic
hDataCmd
An application need not free the data handle obtained during this
transaction. If the application needs to process the string after the callback
function returns, however, the application must copy the command string
associated with the data handle. An application can use the DdeGetData
function to copy the data.
See Also
DdeClientTransaction, Ddelnitialize
3.'
#include <ddeml.h>
XTYP MONITOR
hDataEvent = hDatai
fwEvent = dwData2i
712
hDataEvent
fwEvent
Value
Meaning
MF_CALLBACKS
Value
Meaning
MF_CONV
MF_LINKS
Return Value
See Also
#include <ddeml.h>
XTYP POKE
hszTopic = hszl;
hszltem = hsz2;
hDataPoke = hData;
hszTopic
hszItem
713
hDataPoke
Return Value
Comments
See Also
DdeClientTransaction, Ddelnitialize
XlYP_REGISTER
3.1
#include <ddeml.h>
XTYP REGISTER
Return Value
Comments
hszBaseServName
hszlnstServName
714
Ddelnitialize, DdeNameService
3.1
#include <ddeml.h>
XTYP_REQUEST
hszTopic = hszl;
hszItem = hsz2;
Return Value
Comments
hszTopic
hszltem
3.1
#include <ddeml.h>
XTYP UNREGISTER
hszBaseServName = hszl; /* handle of base service-name string
*/
hszlnstServName = hsz2; /* handle of instance service-name string */
715
Return Value
Comments
hszBaseServName
hszlnstServName
Ddelnitialize, DdeNameService
3.1
#include <ddernl.h>
XTYP WILDCONNECT
hszTopic = hszl;
hszService = hsz2;
pcc = (CONVCONTEXT FAR *)dwDatal;
fSamelnst = (BOOL) dwData2;
/*
/*
/*
/*
*/
*/
*/
*/
716
hszTopic
Return Value
hszServiee
pee
fSameInst
Comments
A server cannot block this transaction type; the CBR_BLOCK return code
is ignored.
See Also
DdeConnect, Ddelnitialize
3.1
#include <ddeml.h>
XTYP XACT COMPLETE
hszTopic = hszl;
hszltem = hsz2;
hDataxact = hData;
dwXactID = dwDatal;
fwStatus = dWData2;
/*
/*
!*
/*
!*
*!
*!
*!
*!
*!
717
Return Value
Comments
See Also
718
hszTopic
hszltem
hDataXact
dwXactID
fwStatus
11
COLOROKSTRING
3.1
wParam
Not used.
IParam
719
FILEOKSTRING
Return Value
Comments
To use this message, the application must create a new message identifier
by calling the RegisterWindowMessage function and passing the
COLOROKSTRING constant as the single parameter.
See Also
RegisterWindowMessage
FILEOKSTRING
3.1
The FILEOKSTRING message is sent by the Open dialog box or Save As
dialog box to the application's hook function when the user has selected a
filename and chosen the OK button. The message lets the application
accept or reject the user-selected filename.
Parameters
Return Value
Comments
See Also
720
wParam
Not used.
IParam
HELPMSGSTRING
FINDMSGSTRING
3.1
Return Value
Comments
See Also
wParam
Not used.
IParam
HELPMSGSTRING
3.1
Return Value
Comments
wParam
Not used.
IParam
721
LBSELCHSTRING
RegisterWindowMessage
3.1
LBSELCHSTRING
wParam
IParam
Value
Meaning
CD_LBSELCHANGE
CD_LBSELSUB
CD_LBSELADD
CD_LBSELNOITEMS
Return Value
Comments
See Also
722
SHAREVISTRING
SETRGBSTRING
3.1
The SETRGBSTRING message is sent by an application's hook function to
a Color dialog box to set a custom color.
Parameters
Return Value
Comments
See Also
wParam
Not used.
IParam
SHAREVISTRING
3.1
Return Value
Comments
wParam
Not used.
IParam
723
SHAREVISTRING
724
A
ABC structure, 539
Advise transaction, DDEML, 59
Application (service) name, DDE servers, 40
Asynchronous transaction, DDEML, 61
B
BN HILITE message, 536
BN- PAINT message, 536
BN=UNHILITE message, 536
C
CB ADDSTRING message, 503
CB- DELETESTRING message, 504
CB- FINDSTRINGEXACT message, 505
CB=GETDROPPEDCONTROLRECT
message, 505
CB GETDROPPEDSTATE message, 506
CB- GETEXTENDEDUI message, 507
CB- GETITEMHEIGHT message, 507
CB- SETEXTENDEDUI message, 508
CB- SETITEMHEIGHT message, 509
CB.N CLOSEUP message, 537
CBN-SELENDCANCEL message, 537
CBN- SELENDOK message, 538
CBT -CREATEWND structure, 540
CBTACTIVATESTRUCT structure, 540
ChooseColor function, 8, 9
CHOOSECOLOR structure, 7, 8,541
ChooseFont function, 11
CHOOSE FONT structure, 11,544
Class Name Object command,
OLE applications, 109
Index
725
726
D
Data handle
dynamic data exchange, 54
Data types, defined, 493
DdeAbandonTransaction function, 62
DdeAccessData function
command strings, 60
global memory objects, 56
DDEACK structure, 562
DdeAddData function, 57
DDEADVISE structure, 563
DdeCallback function, 44
DdeClientTransaction function
ad vise transaction, 59
execute transaction, 60
poke transaction, 58
request transaction, 57
synchronous and asynchronous
transactions, 61
DdeConnect function, 49
DdeConnectList function, 52, 53
DdeCreateDataHandle function, 54
DdeCreateStringHandle function, 45
DDEDATA structure, 564
DdeDisconnect function, 52, 54
DdeDisconnectList function, 54
DdeEnableCallback function, 62
DdeFreeDataHandle function, 57
DdeFreeStringHandle function, 46
DdeGetData function, 56
Ddelnitialize function
initializing DDEML, 42
monitoring DDE applications, 66
Windows API Guide
DdeKeepStringHandle function, 46
DdeNameService function, 47, 48
DDEPOKE structure, 565
DdePostAdvise function, 59
DdeQueryConvlnfo function, 52, 53, 62
DdeQueryNextServer function, 53
DdeQueryString function, 45
DdeReconnect function, 52
DdeSetUser Handle function, 62
DdeUnaccessData function, 56
DdeUninitialize function, 43
DEBUGHOOKINFO structure, 566
DECLARE_HANDLE macro, 695
DECLARE_HANDLE32 macro, 695
DefLoadFromStream function, 123
DEVNAMES structure, 567
DllCreateFromClip function, 122
DllLoadFromStream function, 123
DOCINFO structure, 568
Do Verb function, OLEOBJECTVTBL
structure, 625
DRIVERINFOSTRUCT structure, 569
DRVCONFIGINFO structure, 569
Dynamic data exchange (DDE)
described, 37
OLE libraries
client applications, 124
conversations, 128
execute strings, 131, 132
server applications, 127
standard item names, 129
System topic, items for, 128
using for standard DDE operations, 77
Dynamic Data Exchange Management
Library
(DDEML)
callback function, 44
client and server interaction, 39
conversations
multiple conversations, 52
single conversations, 49
suspending, 62
termina ting, 43
data management, 54
Index
described, 37
error detection, 66
initializing, 42
item names, 40
monitoring applications, 66
vs. OLE, 76
OLE, using with DDEML, 79
service names
described,40
registering, 47
service-name filter, 48
string management, 45
System topic, 40
topic names,40
transaction management
advise transaction, 59
asynchronous transactions, 61
controlling transactions, 62
execute transaction, 60
poke transaction, 58
request transaction, 57
synchronous transactions, 61
transaction classes, 63
transaction summary, 64
transaction, defined, 39
E
Edit function, OLESERVERVTBL structure,
640
EM_GETFIRSTVISIBLELINE message, 510
EM_GETPASSWORDCHAR message, 510
EM_GETWORDBREAKPROC message, 511
EM_SETREADONLY message, 511
EM_SETWORDBREAKPROC message, 512
Embedded object
defined, 74
EnumClipboardFormats function, 108
Error detection
common dialog boxes, 35
DDEML functions, 66
EVENTMSG structure, 570
Execute function
OLESERVERDOCVTBL structure, 636
OLESERVERVTBL structure, 642
727
H
FIELDOFFSET macro, 696
FILEOKSTRING message, 720
Find dialog box
displaying, 23
processing messages, 26
FINDMSGSTRING message, 26, 721
FINDREPLACE structure, 23, 25, 571
FindText function, 23
FIXED structure, 575
FMS_GETDRIVEINFO structure, 576
FMS_GETFILESEL structure, 577
FMS_LOAD structure, 578
Font dialog box, 11
Functions
DdeCallback function, 44
OLE functions
asynchronous operations, 101
document management, 98
object creation, 105
object handlers, 120
server applications, 111
G
Get function, OLESTREAMVTBL structure,
644
GetBValue macro, 696
GetData function, 79
GetData function, OLEOBJECTVTBL
structure, 626
GetGValue macro, 697
GetObject function, 79
GetObject function, OLESERVERDOCVTBL
structure, 633
GetOpenFileName function, 13
728
J
JUST_VAL UE_STRUCT structure, 703
K
KERNINGPAIR structure, 586
l
LB_FINDSTRINGEXACT message,513
LB_GETCARETINDEX message, 514
LB_SETCARETINDEX message, 514
LBN_SELCANCEL message, 538
LBSELCHSTRING message, 722
Linked object
defined,73
LoadString function, 16
LOCALENTRY structure, 587
LOCALINFO structure, 590
LOGFONT structure
Font dialog box, 13
TrueType fonts, server applications, 116
Windows API Guide
M
MAKELP macro, 697
MAKELPARAM macro, 698
MAKELRESULT macro, 698
MAT2 structure, 591
MEMMANINFO structure, 592
Metafile
OLE server applications, 116
METAHEADER structure, 593
METARECORD structure, 594
MINMAXINFO structure, 595
MODULE ENTRY structure, 596
MONCBSTRUCT structure, 597
MONCONVSTRUCT structure, 598
MONERRSTRUCT structure, 599
MONHSZSTRUCT structure, 600
Monitoring applications, 66
MONLINKSTRUCT structure, 602
MONMSGSTRUCT structure, 603
MOUSEHOOKSTRUCT structure, 604
MOUSETRAILS printer escape, 701
N
Native clipboard format, 82
NCCALCSIZE_PARAMS structure, 605
NEWCPLINFO structure, 606
NEWTEXTMETRIC structure, 607
NFYLOADSEG structure, 612
NFYLOGERROR structure, 613
NFYLOGPARAMERROR structure, 614
NFYRIP structure, 615
NFYSTARTDLL structure, 616
o
Object handler, OLE libraries
creating objects in, 122
described, 80
implementing, 119
Object linking and embedding (OLE)
benefits of OLE, 75
client applications
asynchronous operations, 99
Class Name Object command, 109
Index
closing, 110
closing documents, 99
copying objects, 103
creating objects, 105
deleting objects, 103
described, 95
displaying objects, 102
document management, 98
opening and closing objects, 103
Paste and Paste Link commands, 107
printing objects, 102
saving documents, 99
starting,96
Undo command, 108
compound documents
described, 72
illustrated, 72
opening, 97
data transfer
client applications, 80
client user interface, 88
clipboard conventions, 81
commands, new and changed, 88
communication between libraries, 81
object handlers, 80
packages, 91
registration database, 85
server applications, 80
server user interface, 92
version control for servers, 87
DDEML
vs. OLE, 76
using with OLE, 79
dynamic data exchange
client applications, 124
conversations, 128
DDE operations, using OLE for, 77
execute strings, 131, 132
server applications, 127
standard item names, 129
System topic, items for, 128
embedded object, defined, 74
formats for storing objects, 93
linked object, defined, 73
729
object handlers
creating objects in, 122
implementing,119
OLECLI.DLL library, 80
OLESVR.DLL library, 80
packages, 74
server applications
closing, 117
Cut and Copy commands, 115
functions, 111
opening documents or objects, 115
Save and Save As commands, 116
starting, 112
Update command, 116
verbs, 74
ObjectLink clipboard format, 82
ObjectLong function, OLEOBJECTVTBL
structure, 627
OFFSETOF macro, 699
OleActivate function
Class Name Object command,
implementing,109
opening objects, 103
OleBlockServer function
asynchronous operations, 100
queued client-library requests, 114
OLECLIENT structure, 617
object handlers, 121
opening compound documents, 98
starting client applications, 96
OLECLIENTVTBL structure, 96, 617
OleClone function
copying objects to the clipboard, 105
restoring updated objects, 108
OleClose function, 103
OleCopyFromLink function, 106
OleCopyToClipboard function, 89, 103
OleCreate function, 106
OleCreateFromClip function
client applications, 107
object handlers, 122
OleCreateFromFile function, 78
OleCreateFromTemplate function, 106
OleCreateLinkFromClip function, 107
730
p
Package, OLE applications, 74, 91
PANOSE structure, 659
Paste command, OLE applications, 107
Paste Link command, OLE applications, 107
Paste Special command, OLE applications,
108
POINTFX structure, 664
Poke transaction, DDEML, 58
POSTSCRIPT_DATA printer escape
See PASSTHROUGH printer escape
POSTSCRIPT_IGNORE printer escape, 702
Print dialog box, 20, 21
Print Setup dialog box, 20
PrintDlg function, 21
PRINTDLG structure, 21, 665
Printer
default printer, 21
Put function, OLESTREAMVTBL structure,
644
R
RASTERIZER_STATUS structure, 673
RegisterClipboardFormat function, 87, 113
RegisterWindowMessage function
Color dialog box, 10
filenames, monitoring, 19
Find and Replace dialog boxes, 26
Help button in common dialog boxes, 34
list box controls, monitoring, 18
Open dialog box, 16
Registration database
OLE applications, 85
Release function
OLEOBJECTVTBL structure, 624
OLESERVERDOCVTBL structure, 634
OLESERVERVTBL structure, 641
Replace dialog box
731
displaying, 25
processing messages, 26
ReplaceText function, 25
Request transaction, DDEML, 57
RGB color model,S
S
Save As command, OLE server applications,
116
Save As dialog box
displaying, 16
filenames, monitoring, 19
list box controls, monitoring, 18
Save command, OLE server applications, 116
Save function, OLESERVERDOCVTBL
structure, 631
SearchFile function, 26
SEGINFO structure, 673
SELECTOROF macro, 699
Server applications
DDE transactions, 39
OLE servers
closing, 117
Cut and Copy commands, 115
DDE, direct use of, 127
DDE, required commands, 132
described, 80
functions, 111
opening documents or objects, 115
Save and Save As commands, 116
server user interface, 92
starting, 112
Update command, 116
version control, 87
Service name, DDE servers, 40
SETALLJUSTVALUES printer escape, 703
SetClipboardData function
client applications, 103
server applications, 115
SetColorScheme function
OLEOBJECTVTBL structure, 628
OLESERVERDOCVTBL structure, 635
SetData function, OLEOBJECTVTBL
structure, 626
732
SetDocDimensions function,
OLESERVERDOCVTBL structure, 633
SetHostNames function
OLESERVERDOCVTBL structure, 632
SETRGBSTRING message, 723
SetTargetDevice function,
OLEOBJECTVTBL structure, 627
SHAREVISTRING message, 723
Shell library
OLE applications, 85
Show function, OLEOBJECTVTBL
structure, 624
SIZE structure, 675
STACKTRACEENTRY structure, 676
STM_GETICON message, 515
STM_SETICON message, 515
String handle, DDE, 45
Synchronous transaction, DDEML, 61
SYSHEAPINFO structure, 677
System topic, DDEML, 40
Systems topic, DDE-based OLE, 128
T
TASKENTRY structure, 678
Template, common dialog box, 31
TIMERINFO structure, 679
Topic name, DDE servers, 40
Transaction, DDE
defined, 39
TrueType fonts, server applications, 116
TTPOLYCURVE structure, 680
TTPOLYGONHEADER structure, 681
U
Undo command, OLE applications, 108
Update command, OLE server applications,
116
V
Verb, object linking and embedding, 74
Version control for OLE servers, 87
VS_FIXEDFILEINFO structure, 682
Windows API Guide
W
WINDEBUGINFO structure, 686
WINDOWPLACEMENT structure, 690
WINDOWPOS structure, 692
Windows data types, defined, 493
WinHelp function, 34
WM_CHOOSEFONT_GETLOGFONT
message,
13,516
WM_COMMNOTIFY message, 517
WM_DDE_ACK message, 517
WM_DDE_ADVISE message, 79,520
WM_DDE_DATA message, 521
WM_DDE_EXECUTE message, 523
WM_DDE_INITIATE message, 524
WM_DDE_POKE message, 78, 526
WM_DDE_REQUEST message, 527
WM_DDE_TERMINATE message, 528
WM_DDE_UNADVISE message, 529
WM_DROPFILES message, 107,530
WM_INITDIALOG message, 27
WM_PALETTEISCHANGING message, 530
WM_POWER message, 531
WM_QUEUE SYNC message, 532
WM_SYSTEMERROR message, 532
WM_USER message, 533
WM_WINDOWPOSCHANGED message,
534
WM_WINDOWPOSCHANGING message,
535
X
XTYP_ADVDATA transaction, 705
XTYP_ADVREQ transaction, 706
XTYP_ADVSTART transaction, 59, 707
XTYP_ADVSTOP transaction, 60, 708
XTYP_CONNECT transaction, 49, 708
XTYP_CONNECT_CONFIRM transaction,
49,52,709
XTYP_DISCONNECT transaction, 52, 54,
710
XTYP_ERROR transaction, 711
XTYP_EXECUTE transaction, 60, 711
XTYP_MONITOR transaction, 68, 712
Index
733
BORLAND
Corporate Headquarters: 1800 Green Hills Road, P.O. Box 660001, Scotts Valley, CA 95067-0001, (408) 438-5300. Offices in: Australia,
Belgium, Canada, Denmark, France, Germany, Hong Kong, Italy, Japan, Korea, Malaysia, Netherlands, New Zealand, Singapore, Spain,
Sweden, Taiwan and United Kingdom. Part #14MN-API03-31 BOR 3985