网站首页  词典首页

请输入您要查询的函数:

 

术语 createwaitabletimer
释义 CreateWaitableTimer
语法:
C++
HANDLE WINAPI CreateWaitableTimer(
__in_opt LPSECURITY_ATTRIBUTES lpTimerAttributes,
__in BOOL bManualReset,
__in_opt LPCTSTR lpTimerName
);
CreateWaitableTimer功能
创建或打开一个可等待计时器对象。
要指定一个对象的访问掩码,使用CreateWaitableTimerEx功能。
参数
lpTimerAttributes [中,可选]
一个 SECURITY_ATTRIBUTES结构,指定为新的计时器对象的安全描述符,并决定是否可以继承子进程返回的句柄的指针。
如果lpTimerAttributes为NULL,则计时器对象都将获得一个默认的安全描述符和处理不能被继承。在对来自定时器默认安全描述符的ACL或模拟的主要创造者的象征。
bManualReset [in]
如果此参数为TRUE,定时器是一个手动重置计时器通知。否则,计时器同步计时器。
lpTimerName [中,可选]
定时器的对象的名称。该名称被限制为MAX_PATH字符。名称比较是区分大小写的。
如果lpTimerName为NULL,则计时器对象创建没有名称。
如果lpTimerName匹配现有的事件,信号量,互斥,工作,或文件映射对象,函数失败并GetLastError返回出现ERROR_INVALID_HANDLE名称。这是因为这些对象共享相同的名称空间。
这个名称可以有一个“全球\\”或“Local \\”前缀明确创建对象的全球或会话名称空间。名称的其余部分可以包含以外的任何字符反斜杠字符(\\)。如需信息见命名内核对象。快速用户切换是使用终端服务会话。内核对象名称必须遵循概述了终端服务,使应用程序能够支持多个用户的指导方针。
窗口2000:如果终端服务没有运行,“全球\\”和“地方\\”前缀将被忽略。名称的其余部分可以包含反斜杠以外的任何字符的字符。
该对象可以创建一个私人空间。有关更多信息,请参见对象命名。
返回值
如果函数成功,返回值是一个句柄计时器对象。如果计时器对象命名函数调用之前的存在,该函数返回的句柄现有的对象和GetLastError返回ERROR_ALREADY_EXISTS。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
备注
句柄返回CreateWaitableTimer是与TIMER_ALL_ACCESS访问权限创建,它可以在任何函数,需要一个句柄计时器对象,提供来电者已被授予使用。如果一个计时器是从服务或线程模拟不同的用户创建的,您可以申请一个安全描述符计时器当您创建,或者通过改变其默认的DACL为创建进程的默认安全描述符。有关更多信息,请参阅同步对象的安全和访问权限。
任何调用进程的线程可以指定计时器对象在调用句柄在等待职能之一。
多个进程可以处理同一个计时器对象,从而能够为进程间同步对象的使用。
由CreateProcess函数创建一个进程可以继承的句柄计时器对象如果CreateWaitableTimer lpTimerAttributes参数使继承。
一个进程可以指定计时器对象在调用句柄DuplicateHandle函数。由此产生的手柄可以使用另一个进程。
一个进程可以指定在调用一个计时器对象的名称的OpenWaitableTimer或CreateWaitableTimer功能。
使用CloseHandle函数关闭处理。该系统关闭时自动处理过程终止。计时器对象被销毁时,其最后处理已关闭。
要编译的应用程序使用此功能,定义_WIN32_WINNT为0x0400或更高版本。有关详细信息,请参阅使用Windows头。
实例
举一个例子,它使用CreateWaitableTimer,请参阅使用可等待定时器对象。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesCreateWaitableTimerW(Unicode)和CreateWaitableTimerA(ANSI)的
参见
CancelWaitableTimer
CloseHandle
CreateProcess的
CreateWaitableTimerEx
DuplicateHandle
FILETIME
对象名称
OpenWaitableTimer
SECURITY_ATTRIBUTES
SetWaitableTimer
同步功能
可等待定时器对象
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==CreateWaitableTimer Function
Creates or opens a waitable timer object.
To specify an access mask for the object, use the CreateWaitableTimerEx function.
Syntax
C++
HANDLE WINAPI CreateWaitableTimer(
__in_opt LPSECURITY_ATTRIBUTES lpTimerAttributes,
__in BOOL bManualReset,
__in_opt LPCTSTR lpTimerName
);
Parameters
lpTimerAttributes [in, optional]
A pointer to a SECURITY_ATTRIBUTES structure that specifies a security descriptor for the new timer object and determines whether child processes can inherit the returned handle.
If lpTimerAttributes is NULL, the timer object gets a default security descriptor and the handle cannot be inherited. The ACLs in the default security descriptor for a timer come from the primary or impersonation token of the creator.
bManualReset [in]
If this parameter is TRUE, the timer is a manual-reset notification timer. Otherwise, the timer is a synchronization timer.
lpTimerName [in, optional]
The name of the timer object. The name is limited to MAX_PATH characters. Name comparison is case sensitive.
If lpTimerName is NULL, the timer object is created without a name.
If lpTimerName matches the name of an existing event, semaphore, mutex, job, or file-mapping object, the function fails and GetLastError returns ERROR_INVALID_HANDLE. This occurs because these objects share the same name space.
The name can have a "Global\\" or "Local\\" prefix to explicitly create the object in the global or session name space. The remainder of the name can contain any character except the backslash character (\\). For more information, see Kernel Object Namespaces . Fast user switching is implemented using Terminal Services sessions. Kernel object names must follow the guidelines outlined for Terminal Services so that applications can support multiple users.
Windows 2000: If Terminal Services is not running, the "Global\\" and "Local\\" prefixes are ignored. The remainder of the name can contain any character except the backslash character.
The object can be created in a private namespace. For more information, see Object Namespaces .
Return Value
If the function succeeds, the return value is a handle to the timer object. If the named timer object exists before the function call, the function returns a handle to the existing object and GetLastError returns ERROR_ALREADY_EXISTS.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
The handle returned by CreateWaitableTimer is created with the TIMER_ALL_ACCESS access right; it can be used in any function that requires a handle to a timer object, provided that the caller has been granted access. If a timer is created from a service or thread that is impersonating a different user, you can either apply a security descriptor to the timer when you create it, or change the default security descriptor for the creating process by changing its default DACL. For more information, see Synchronization Object Security and Access Rights .
Any thread of the calling process can specify the timer object handle in a call to one of the wait functions .
Multiple processes can have handles to the same timer object, enabling use of the object for interprocess synchronization.
A process created by the CreateProcess function can inherit a handle to a timer object if the lpTimerAttributes parameter of CreateWaitableTimer enables inheritance.
A process can specify the timer object handle in a call to the DuplicateHandle function. The resulting handle can be used by another process.
A process can specify the name of a timer object in a call to the OpenWaitableTimer or CreateWaitableTimer function.
Use the CloseHandle function to close the handle. The system closes the handle automatically when the process terminates. The timer object is destroyed when its last handle has been closed.
To compile an application that uses this function, define _WIN32_WINNT as 0x0400 or later. For more information, see Using the Windows Headers .
Examples
For an example that uses CreateWaitableTimer, see Using Waitable Timer Objects .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesCreateWaitableTimerW (Unicode) and CreateWaitableTimerA (ANSI)
See Also
CancelWaitableTimer
CloseHandle
CreateProcess
CreateWaitableTimerEx
DuplicateHandle
FILETIME
Object Names
OpenWaitableTimer
SECURITY_ATTRIBUTES
SetWaitableTimer
Synchronization Functions
Waitable Timer Objects
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms682492(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 11:25:38