怎样发送匿名消息

google321 2003-12-13 06:50:45
有些软件在局域网发消息可以匿名。不知道是怎样实现的,和net send有没有关系。
...全文
267 点赞 收藏 8
写回复
8 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
google321 2003-12-15
回复
google321 2003-12-15
回复
google321 2003-12-15
谢了,还没调试,但先给分。
回复
xiaoxiao197821 2003-12-13
发送者可以任意
function NetSend(dest, Source, Msg: string): Longint;
type
TNetMessageBufferSendFunction = function(servername, msgname, fromname: PWideChar;
buf: PWideChar; buflen: Cardinal): Longint;
stdcall;
var
NetMessageBufferSend: TNetMessageBufferSendFunction;
SourceWideChar: PWideChar;
DestWideChar: PWideChar;
MessagetextWideChar: PWideChar;
Handle: THandle;
begin
Handle := LoadLibrary('NETAPI32.DLL');
if Handle = 0 then
begin
Result := GetLastError;
Exit;
end;
@NetMessageBufferSend := GetProcAddress(Handle, 'NetMessageBufferSend');
if @NetMessageBufferSend = nil then
begin
Result := GetLastError;
Exit;
end;

MessagetextWideChar := nil;
SourceWideChar := nil;
DestWideChar := nil;

try
GetMem(MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);
GetMem(DestWideChar, 20 * SizeOf(WideChar) + 1);
StringToWideChar(Msg, MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);
StringToWideChar(Dest, DestWideChar, 20 * SizeOf(WideChar) + 1);

if Source = '' then
Result := NetMessageBufferSend(nil, DestWideChar, nil,
MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1)
else
begin
GetMem(SourceWideChar, 20 * SizeOf(WideChar) + 1);
StringToWideChar(Source, SourceWideChar, 20 * SizeOf(WideChar) + 1);
Result := NetMessageBufferSend(nil, DestWideChar, SourceWideChar,
MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);
FreeMem(SourceWideChar);
end;
finally
FreeMem(MessagetextWideChar);
FreeLibrary(Handle);
end;
end;
回复
angle097113 2003-12-13
shellexec()应该是shellexecute()的
回复
angle097113 2003-12-13
我估计用api就是那个shellexec()直接调用net send的exe应该也是可以实现的吧
回复
jxc163 2003-12-13
看微软的SDK中有没有关于Messager服务的说明。信使服务
回复
wave_f 2003-12-13
up,no1
回复
发动态
发帖子
网络通信/分布式开发
创建于2007-08-02

1566

社区成员

Delphi 网络通信/分布式开发
申请成为版主
社区公告
暂无公告