网站首页  词典首页

请输入您要查询的函数:

 

术语 createdc
释义 CreateDC
语法:
HDC CreateDC(
LPCTSTR lpszDriver,
__in LPCTSTR lpszDevice,
LPCTSTR lpszOutput,
__in const DEVMODE *lpInitData
);
CreateDC函数
该CreateDC函数创建一个使用指定的名称设备设备上下文(DC)。
参数
lpszDriver
一个指向 null 结尾的字符串指针指定显示结果或一个特定的显示设备或打印提供者,通常是WINSPOOL名称。
lpszDevice [in]
一个指向 null 结尾的字符串指针指定的特定输出设备所使用的名称所示,在打印管理器(例如,爱普生外汇- 80)。这不是打印机型号的名称。该lpszDevice参数必须使用。
要获得有效的显示名称,电话EnumDisplayDevices。
如果lpszDriver是显示或一个特定的显示设备设备名称,然后lpszDevice必须为NULL或相同的设备名。如果lpszDevice为NULL,则DC是创造了主显示设备。
如果在系统上多台监视器,调用CreateDC(文本(“显示”),空,空,空)将创建一个DC涵盖所有监视器。
lpszOutput
此参数被忽略,应设置为NULL。它仅仅为16位Windows的兼容性。
lpInitData [in]
一个DEVMODE结构包括设备,该设备的驱动程序特定的初始化数据指针。该DocumentProperties函数检索在指定的设备填补了这个结构。该lpInitData参数必须为NULL,如果该设备驱动程序是使用默认的初始化(如有)由用户指定。
如果lpszDriver是展示,那么lpInitData必须为NULL。显示设备当前的DEVMODE使用。
返回值
如果函数成功,返回值是处理指定的设备到DC。
如果函数失败,返回值为NULL。该函数将返回的DEVMODE结构比目前的DEVMODE其他空。
备注
请注意,处理到DC只能由一个线程使用在任何一个时间。
对于参数lpszDriver和lpszDevice,呼吁EnumDisplayDevices获取显示器的有效名称。
当您不再需要的DC,调用DeleteDC函数。
如果lpszDriver或lpszDevice是显示,线程调用CreateDC拥有创建的HDC。当此线程被破坏,为HDC不再有效。因此,如果您创建HDC和它传递给另一个线程,然后退出第一个线程,第二个线程将无法使用的HDC。
ICM的:要启用ICM的,设置DEVMODE结构dmICMMethod成员(指向的pInitData参数)为适当的值。
实例
有关示例,请参见捕捉图像。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWingdi.h(头文件:winuser.h)
LibraryGdi32.lib
DLLGdi32.dll
Unicode和ANSI namesCreateDCW(Unicode)和CreateDCA(ANSI)的
参见
设备上下文概述
设备上下文函数
多显示监视器
DeleteDC
的DEVMODE
EnumDisplayDevices
DOCINFO
DocumentProperties
StartDoc
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==CreateDC Function
The CreateDC function creates a device context (DC) for a device using the specified name.
Syntax
HDC CreateDC(
LPCTSTR lpszDriver,
__in LPCTSTR lpszDevice,
LPCTSTR lpszOutput,
__in const DEVMODE *lpInitData
);
Parameters
lpszDriver
A pointer to a null-terminated character string that specifies either DISPLAY or the name of a specific display device or the name of a print provider, which is usually WINSPOOL.
lpszDevice [in]
A pointer to a null-terminated character string that specifies the name of the specific output device being used, as shown by the Print Manager (for example, Epson FX-80). It is not the printer model name. The lpszDevice parameter must be used.
To obtain valid names for displays, call EnumDisplayDevices .
If lpszDriver is DISPLAY or the device name of a specific display device, then lpszDevice must be NULL or that same device name. If lpszDevice is NULL, then a DC is created for the primary display device.
If there are multiple monitors on the system, calling CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) will create a DC covering all the monitors.
lpszOutput
This parameter is ignored and should be set to NULL. It is provided only for compatibility with 16-bit Windows.
lpInitData [in]
A pointer to a DEVMODE structure containing device-specific initialization data for the device driver. The DocumentProperties function retrieves this structure filled in for a specified device. The lpInitData parameter must be NULL if the device driver is to use the default initialization (if any) specified by the user.
If lpszDriver is DISPLAY, then lpInitData must be NULL. The display device's current DEVMODE is used.
Return Value
If the function succeeds, the return value is the handle to a DC for the specified device.
If the function fails, the return value is NULL. The function will return NULL for a DEVMODE structure other than the current DEVMODE.
Remarks
Note that the handle to the DC can only be used by a single thread at any one time.
For parameters lpszDriver and lpszDevice, call EnumDisplayDevices to obtain valid names for displays.
When you no longer need the DC, call the DeleteDC function.
If lpszDriver or lpszDevice is DISPLAY, the thread that calls CreateDC owns the HDC that is created. When this thread is destroyed, the HDC is no longer valid. Thus, if you create the HDC and pass it to another thread, then exit the first thread, the second thread will not be able to use the HDC.
ICM: To enable ICM, set the dmICMMethod member of the DEVMODE structure (pointed to by the pInitData parameter) to the appropriate value.
Examples
For an example, see Capturing an Image .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWingdi.h (include Windows.h)
LibraryGdi32.lib
DLLGdi32.dll
Unicode and ANSI namesCreateDCW (Unicode) and CreateDCA (ANSI)
See Also
Device Contexts Overview
Device Context Functions
Multiple Display Monitors
DeleteDC
DEVMODE
EnumDisplayDevices
DOCINFO
DocumentProperties
StartDoc
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd183490(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:25:48