📄 dibapi.txt
字号:
lpDCRect LPRECT Specifies the destination
coordinates of the bitmap
being drawn.
hDIB HDIB Specifies the DIB.
lpDIBRect LPRECT Specifies the area of the DIB
to be drawn.
hPal HPALETTE Specifies the palette to
be associated with the DIB.
Return Value The value returned is non-zero if successful.
Otherwise, it is zero.
Comments Note that the palette is selected and realized as a
background palette. If a foreground palette is
needed, it must be selected as foreground and
realized before calling this function.
PaletteSize
Syntax WORD PaletteSize(lpDIB)
This function gets the size required to store the
specified DIB's palette.
Parameter Type/Description
lpDIB LPSTR Pointer to a DIB specification.
Return Value The value returned specifies the size of the
DIB's color palette.
Comments This function requires a pointer to a DIB rather than
an HDIB. In order to use this function with an HDIB,
you must first call the Windows GlobalLock function
on the HDIB, and pass the resulting pointer to this
function.
PalEntriesOnDevice
Syntax int PalEntriesOnDevice(hDC)
This function gets the number of palette entries on a
specified device.
Parameter Type/Description
hDC HDC Specifies the device.
Return Value The value returned specifies the number of
palette entries.
PrintDIB
Syntax WORD PrintDIB(hDib, fPrintOpt, wXScale, wYScale,
szJobName)
This function prints the specified DIB.
Parameter Type/Description
hDib HDIB Specifies the handle to a DIB
which is to be printed
fPrintOpt WORD Specifies the printing option.
wXScale WORD Specifies the x-axis scaling
factor for the printed window.
The x and y scaling factors
are only used if the PW_SCALE
option is selected for the
fPrintOpt parameter.
wYScale WORD Specifies the y-axis scaling
factor.
szJobName LPSTR Specifies the name of the print
job. This string is used in
the job name sent to the print
spooler, as well as in the
print dialog box.
The fPrintOpt parameter must be set to one of the
following:
Value Meaning
PW_BESTFIT Fits the printed screen on the page
in as large of a area as possible
while still retaining the correct
screen aspect ratio. The wXScale
and wYScale parameters are not
used if this option is selected.
This is the default value.
PW_STRETCHTOPAGE Stretches the printed screen to
fill up the entire printed page.
The wXScale and wYScale parameters
are not used if this option is
selected.
PW_SCALE Scales the printed screen by the
integer scaling factors specified
in the wXScale and wYScale
parameters. If the scaling is
set too large, the screen may
extend off the printed page and
will be clipped.
Return Value 0 if successful, or one of: ERR_INVALIDHANDLE,
ERR_LOCK, ERR_SETABORTPROC, ERR_STARTDOC,
ERR_NEWFRAME, ERR_ENDDOC, ERR_GETDC,
ERR_STRETCHDIBITS. These constants are defined in
dibapi.h.
PrintScreen
Syntax WORD PrintScreen(rRegion, fPrintOpt, wXScale,
wYScale, szJobName)
This function prints the specified area of the screen
on the default printer.
Parameter Type/Description
rRegion LPRECT Specifies the region of the
screen (in screen coordinates)
to be printed. To print the
entire screen, set this RECT
to encompass the entire
screen.
fPrintOpt WORD Species the printing options.
wXScale WORD Specifies the x-axis scaling
factor for the printed window.
The x and y scaling factors
are only used if the PW_SCALE
option below is selected.
wYScale WORD Specifies the y-axis scaling
factor.
szJobName LPSTR Specifies the name of the print
job. This string is used in
the job name sent to the print
spooler, as well as in the
print dialog box.
The fPrintOpt parameter must be set to one of the
following:
Value Meaning
PW_BESTFIT Fits the printed screen on the page
in as large of a area as possible
while still retaining the correct
screen aspect ratio. The wXScale
and wYScale parameters are not
used if this option is selected.
This is the default value.
PW_STRETCHTOPAGE Stretches the printed screen to
fill up the entire printed page.
The wXScale and wYScale parameters
are not used if this option is
selected.
PW_SCALE Scales the printed screen by the
integer scaling factors specified
in the wXScale and wYScale
parameters. If the scaling is
set too large, the screen may
extend off the printed page and
will be clipped.
Return Value 0 if successful, or one of: ERR_DIBFUNCTION,
ERR_INVALIDHANDLE, ERR_LOCK, ERR_SETABORTPROC,
ERR_STARTDOC, ERR_NEWFRAME, ERR_ENDDOC, ERR_GETDC,
ERR_STRETCHDIBITS. These constants are defined in
dibapi.h.
PrintWindow
Syntax WORD PrintWindow(hWnd, fPrintArea, fPrintOpt,
wXScale, wYScale, szJobName)
This function prints an entire window or its client
area on the current default printer. Banding is used
if the printer driver supports it.
Parameter Type/Description
hWnd HWND Specifies the window to be
printed.
fPrintArea WORD Specifies the area(s) of the
window to be printed. See
below for a listing of the
possible values for this
parameter.
fPrintOpt WORD Species the printing options.
See below for a listing of the
possible values for this
parameter.
wXScale WORD Specifies the x-axis scaling
factor for the printed window.
The x and y scaling factors
are only used if the PW_SCALE
option below is selected.
wYScale WORD Specifies the y-axis scaling
factor.
szJobName LPSTR Specifies the name of the print
job. This string is used in
the job name sent to the print
spooler, as well as in the
print dialog box.
The fPrintArea parameter must be set to one of the
following:
Value Meaning
PW_WINDOW Print the entire window.
PW_CLIENT Print the client area of the
window.
The fPrintOpt parameter must be set to one of the
following:
Value Meaning
PW_BESTFIT Fits the printed screen on the page
in as large of a area as possible
while still retaining the correct
screen aspect ratio. The wXScale
and wYScale parameters are not
used if this option is selected.
This is the default value.
PW_STRETCHTOPAGE Stretches the printed screen to
fill up the entire printed page.
The wXScale and wYScale parameters
are not used if this option is
selected.
PW_SCALE Scales the printed screen by the
integer scaling factors specified
in the wXScale and wYScale
parameters. If the scaling is
set too large, the screen may
extend off the printed page and
will be clipped.
Return Value 0 if successful, or one of: ERR_DIBFUNCTION,
ERR_INVALIDHANDLE, ERR_LOCK, ERR_SETABORTPROC,
ERR_STARTDOC, ERR_NEWFRAME, ERR_ENDDOC, ERR_GETDC,
ERR_STRETCHDIBITS. These constants are defined in
errors.h.
SaveDIB
Syntax WORD SaveDIB(hDib, lpFileName)
This function saves the specified DIB to a disk file
in Windows 3 DIB format. Although the convention for
naming DIB files is to use a .BMP extension, the
entire file name must be specified.
Parameter Type/Description
hDib HDIB Specifies the handle to a DIB
which is to be saved.
lpFileName LPSTR Specifies the complete path
name of the DOS filename under
which this DIB is to be saved.
Return Value The value returned is zero for success or an
error code of one of the following:
ERR_INVALIDHANDLE, ERR_OPEN, or ERR_LOCK.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -