网站首页  词典首页

请输入您要查询的函数:

 

术语 createmailslot
释义 CreateMailslot
语法:
C++
HANDLE WINAPI CreateMailslot(
__in LPCTSTR lpName,
__in DWORD nMaxMessageSize,
__in DWORD lReadTimeout,
__in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
CreateMailslot功能
创建一个具有指定名称的邮筒,并返回一个句柄,一个邮筒服务器可以用它们来进行业务上的邮筒。在邮筒是本地计算机上创建它。发生错误如果具有指定名称的邮筒已经存在。
参数
lpName [in]
该邮筒的名称。此名称必须具有以下形式:
\\ \\。\\邮筒\\ [路径]名称
在名称字段必须是唯一的。这个名字可能包括由反斜线分隔伪多层次的目录。例如,这两个\\ \\。\\邮筒\\ example_mailslot_name和\\ \\。\\邮筒\\广播\\高清\\拉吉是有效的名称。
nMaxMessageSize [in]
一个单一的信息,可写入邮筒以字节,最大大小。若要指定的信息可以是任意大小,设置此值为0。
lReadTimeout [in]
时间一读操作可以等待消息被写入到邮筒之前超时,以毫秒为单位。下面的值具有特殊的意义。
ValueMeaning
0Returns立即如果存在任何消息。 (系统不会将作为一个错误立即返回。)
MAILSLOT_WAIT_FOREVER
((DWORD值)-1)永远等待一个消息。
此超时值适用于所有后续读取操作和所有继承邮筒处理。
lpSecurityAttributes [中,可选]
一个SECURITY_ATTRIBUTES结构的指针。结构的bInheritHandle成员决定是否返回的句柄可以被继承的子进程。如果lpSecurityAttributes为NULL,则句柄不能被继承。这个结构的lpSecurityDescriptor成员被忽略。
返回值
如果函数成功,返回值是一个句柄邮筒,邮筒在服务器业务中使用。返回的句柄这个函数是异步的,或重叠。
如果函数失败,返回值是INVALID_HANDLE_VALUE。为了获得更多错误信息,调用GetLastError。
备注
在邮筒存在,直到符合下列条件之一:
最后(可能继承或复制)处理它关闭使用CloseHandle函数。
拥有这一进程的最后(可能继承或复制)处理退出。
该系统采用第二种方法破坏邮筒。
要编写一个消息到邮筒,一个进程使用CreateFile函数,指定使用下列格式之一邮筒的名称。
FormatUsage
\\ \\。\\邮筒\\ nameRetrieves客户端处理到本地邮筒。
\\ \\计算机名\\邮筒\\ nameRetrieves客户句柄远程邮筒。
\\ \\域名\\邮筒\\ nameRetrieves客户处理与指定域指定名称的所有邮筒。
\\ \\ * \\邮筒\\ nameRetrieves客户句柄与系统的主域指定名称的所有邮筒。
如果CreateFile指定一个域或使用星号的格式来描述系统的主域,应用程序不能写入向邮筒时间超过424个字节。如果应用程序试图这样做,WriteFile函数失败并GetLastError返回ERROR_BAD_NETPATH。
应用程序必须指定FILE_SHARE_READ国旗使用CreateFile来获取客户端句柄邮筒。
如果CreateFile被称为访问不存在的邮筒,在ERROR_FILE_NOT_FOUND错误代码将被设置。
实例
有关示例,请参阅创建邮槽。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesCreateMailslotW(Unicode)和CreateMailslotA(ANSI)的
参见
CloseHandle
CreateFile
GetMailslotInfo
邮槽函数
邮筒概述
SECURITY_ATTRIBUTES
SetMailslotInfo
WriteFile
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==CreateMailslot Function
Creates a mailslot with the specified name and returns a handle that a mailslot server can use to perform operations on the mailslot. The mailslot is local to the computer that creates it. An error occurs if a mailslot with the specified name already exists.
Syntax
C++
HANDLE WINAPI CreateMailslot(
__in LPCTSTR lpName,
__in DWORD nMaxMessageSize,
__in DWORD lReadTimeout,
__in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
Parameters
lpName [in]
The name of the mailslot. This name must have the following form:
\\\\.\\mailslot\\[path]name
The name field must be unique. The name may include multiple levels of pseudo directories separated by backslashes. For example, both \\\\.\\mailslot\\example_mailslot_name and \\\\.\\mailslot\\abc\\def\\ghi are valid names.
nMaxMessageSize [in]
The maximum size of a single message that can be written to the mailslot, in bytes. To specify that the message can be of any size, set this value to zero.
lReadTimeout [in]
The time a read operation can wait for a message to be written to the mailslot before a time-out occurs, in milliseconds. The following values have special meanings.
ValueMeaning
0Returns immediately if no message is present. (The system does not treat an immediate return as an error.)
MAILSLOT_WAIT_FOREVER
((DWORD)-1)Waits forever for a message.

This time-out value applies to all subsequent read operations and all inherited mailslot handles.
lpSecurityAttributes [in, optional]
A pointer to a SECURITY_ATTRIBUTES structure. The bInheritHandle member of the structure determines whether the returned handle can be inherited by child processes. If lpSecurityAttributes is NULL, the handle cannot be inherited. The lpSecurityDescriptor member of the structure is ignored.
Return Value
If the function succeeds, the return value is a handle to the mailslot, for use in server mailslot operations. The handle returned by this function is asynchronous, or overlapped.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError .
Remarks
The mailslot exists until one of the following conditions is true:
The last (possibly inherited or duplicated) handle to it is closed using the CloseHandle function.
The process owning the last (possibly inherited or duplicated) handle exits.
The system uses the second method to destroy mailslots.
To write a message to a mailslot, a process uses the CreateFile function, specifying the mailslot name by using one of the following formats.
FormatUsage
\\\\.\\mailslot\\nameRetrieves a client handle to a local mailslot.
\\\\computername\\mailslot\\nameRetrieves a client handle to a remote mailslot.
\\\\domainname\\mailslot\\nameRetrieves a client handle to all mailslots with the specified name in the specified domain.
\\\\*\\mailslot\\nameRetrieves a client handle to all mailslots with the specified name in the system's primary domain.

If CreateFile specifies a domain or uses the asterisk format to specify the system's primary domain, the application cannot write more than 424 bytes at a time to the mailslot. If the application attempts to do so, the WriteFile function fails and GetLastError returns ERROR_BAD_NETPATH.
An application must specify the FILE_SHARE_READ flag when using CreateFile to retrieve a client handle to a mailslot.
If CreateFile is called to access a non-existent mailslot, the ERROR_FILE_NOT_FOUND error code will be set.
Examples
For an example, see Creating a Mailslot .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesCreateMailslotW (Unicode) and CreateMailslotA (ANSI)
See Also
CloseHandle
CreateFile
GetMailslotInfo
Mailslot Functions
Mailslots Overview
SECURITY_ATTRIBUTES
SetMailslotInfo
WriteFile
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa365147(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:24:55