如何向一个已知IP地址的电脑里发一条消息?(win2000/nt/xp系统)(0分)

  • 主题发起人 主题发起人 delpher2003
  • 开始时间 开始时间
D

delpher2003

Unregistered / Unconfirmed
GUEST, unregistred user!
现在上网经常会出现这样的广告框,在一个只有一个‘确定’按钮的对话框里有一段广告。
据说是利用windows2000/NT/XP等操作系统内置的服务进行消息发送。
大家有谁知道这是利用的什么系统服务?
Delphi能实现吗?
 
使用net send命令,具体格式是
net send {name | * | /domain[:name] | /usersmessage}
具体参数说明查看win2000的帮助.
但这个命令和一个服务有关,好像是Message(有些忘了)
在delphi中可以使用shellexec等函数直接执行此命令,这个命令支持通配符.
如果还不会的话,我这里有一个用这个命令做的局域网聊天软件,你可以看看
 
Net sendSends messages to other users, computers, or messaging names on the network.

Syntax
net send {Name | * | /domain[:Name] | /users} message

Parameters
Name
Specifies the user name, computer name, or messaging name to which you want to send the message. If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name"). Long user names might cause problems when they are used as NetBIOS names. NetBIOS names are limited to 16 characters, and the sixteenth character is reserved.
*
Sends the message to all the names in your domain or workgroup.
/domain:Name
Sends the message to all the names in the computer's domain. You can specify Name to send the message to all the names in the specified domain or workgroup.
/users
Sends the message to all users connected to the server.
message
Required. Specifies the text of the message.
net help Command
Displays help for the specified net command.
Remarks
You can send a message only to a name that is active on the network. If you send the message to a user name, that user must be logged on and running the Messenger service to receive the message.
You can broadcast a message to all of the names in your computer's domain (use * or /domain) or to a different domain (/domain:DomainName). Broadcast messages can contain up to 128 characters. Use discretion when you send messages to multiple users.
Examples
To send the message "Meeting changed to 3 P.M. Same place." to the user robertf, type:

net send robertf Meeting changed to 3 P.M. Same place.

To send a message to all users connected to the server, type:

net send /users This server will shut down in 5 minutes.

To send a message that includes a slash mark (/), type:

net send robertf "Format your disk with FORMAT /4"

Formatting legend
Format Meaning
Italic Information that the user must supply
Bold Elements that the user must type exactly as shown
Ellipsis (...) Parameter that can be repeated several times in a command line
Between brackets ([]) Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} Set of choices from which the user must choose only one
Courier font Code or program output
 

function NetMessageBufferSend;external 'netapi32.dll' name 'NetMessageBufferSend';
function SendMsg(servername:PWideChar;ToStr,FromStr,Msg:string):integer;
var
ToName,FromName:array [0..64] of WideChar;
WMsgText:array [0..1000] of WideChar;
MsgLen,i:integer;
begin
for i:=0 to 64 do begin ToName:=#0;FromName:=#0 end;
ToUnicode(ToStr,ToName);
ToUnicode(FromStr,FromName);
for i:=0 to 1000 do WMsgText:=#0;
ToUnicode(Msg,WMsgText);
Result:=NetMessageBufferSend(servername,ToName,FromName,@WMsgText,MsgLen);
end;
function sendmymessage(i: integer): boolean;
var
flag:integer;
sendername:string;
begin
sendername:=Formsend.FromLabeledEdit1.Text;
if sendername ='' then
sendername:=mypcname;

if (Formsend.CheckListBox1.ItemEnabled=true) and (Formsend.CheckListBox1.Checked) then
begin
try
flag:=sendMsg(nil,Formsend.CheckListBox1.Items,sendername,Formsend.memo1.Text);
finally
if flag<>0 then showmessage('发送消息到'+Formsend.CheckListBox1.Items+'失败');
end;
end;
end;

 
>>大家有谁知道这是利用的什么系统服务?
Messenger
 
接受答案了.
 
后退
顶部