请问大家有没有谁使用过NetMessageBufferSend函数呀?

guoxiny 2003-05-13 09:45:15
能不能给一两个例子和使用这个函数的详细说明?
...全文
48 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingzai 2003-05-15
  • 打赏
  • 举报
回复
{
DWORD rc;
wchar_t server[MAXLEN], name[MAXLEN], from[MAXLEN], msg[MAXLEN];
char *message = " hello";

CString szItem = " test";

mbstowcs( server, szItem, MAXLEN );
server[MAXLEN - 1] = L'\0';

mbstowcs( name, szItem, MAXLEN );
name[MAXLEN - 1] = L'\0';
mbstowcs( from, szItem, MAXLEN );
from[MAXLEN - 1] = L'\0';
mbstowcs( msg, szMessage, MAXLEN );
msg[MAXLEN - 1] = L'\0';

rc = ::NetMessageBufferSend( server, name, from, (byte *) &msg[0],
cslen( msg ) * 2 );
}
jijuzheng 2003-05-15
  • 打赏
  • 举报
回复
要用Unicode,看看NowCan(能量、激情、雨水、彩虹——雷雨云) 是怎么说的

http://vip.6to23.com/NowCan1/tech/netmsg.htm
hanson_yi 2003-05-15
  • 打赏
  • 举报
回复
Sorry 我用过这个函数,很正常。997 是Overlapped I/O operation is in progress.
你再看一下return value 是什么,是不是参数出错。
guoxiny 2003-05-13
  • 打赏
  • 举报
回复
大家有没有谁有这方面的例程呀?
guoxiny 2003-05-13
  • 打赏
  • 举报
回复
MSDN里面的说明我已经看了,使用GetLastError()得到的错误代码为997,这个应该如何解决?
laolaoliu2002 2003-05-13
  • 打赏
  • 举报
回复
The NetMessageBufferSend function sends a buffer of information to a registered message alias.


NET_API_STATUS NetMessageBufferSend(
LPCWSTR servername,
LPCWSTR msgname,
LPCWSTR fromname,
LPBYTE buf,
DWORD buflen
);

Parameters
servername
[in] Pointer to a constant string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is NULL, the local computer is used.
Windows NT 4.0 and earlier: This string must begin with \\.

msgname
[in] Pointer to a constant string that specifies the message alias to which the message buffer should be sent.
fromname
[in] Pointer to a constant string specifying who the message is from. If this parameter is NULL, the message is sent from the local computer name.
buf
[in] Pointer to a buffer that contains the message text. For more information, see Network Management Function Buffers.
buflen
[in] Specifies a value that contains the length, in bytes, of the message text pointed to by the buf parameter.
Return Values
If the function succeeds, the return value is NERR_Success.

If the function fails, the return value can be one of the following error codes.


Value Meaning
ERROR_ACCESS_DENIED The user does not have access to the requested information.
ERROR_INVALID_PARAMETER The specified parameter is invalid.
ERROR_NOT_SUPPORTED This network request is not supported.
NERR_NameNotFound The user name could not be found.
NERR_NetworkError A general failure occurred in the network hardware.




Remarks
Windows NT: No special group membership is required to execute the NetMessageBufferSend function on a LAN Manager or a Windows NT system. Admin, Accounts, Print, or Server Operator group membership is required to successfully execute NetMessageBufferSend on a remote server.

Windows 2000/XP: If you call this function on a domain controller that is running Active Directory, access is allowed or denied based on the access control list (ACL) for the securable object. The default ACL permits only Domain Admins and Account Operators to call this function. On a member server or workstation, only Administrators and Server Operators can call this function. For more information, see Security Requirements for the Network Management Functions. For more information on ACLs and ACEs, see Access Control Model.

Requirements
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation.
Server: Included in Windows .NET Server 2003, Windows 2000 Server, Windows NT Server.
Header: Declared in Lmmsg.h; include Lm.h.
Library: Use Netapi32.lib.


guoxiny 2003-05-13
  • 打赏
  • 举报
回复
Help!

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧