建一个bat文件(net send ""),vb里面shell调用

解决方案 »

  1.   

    net 是内部命令吧?可以用
    shell "c:\command.com /c net send ~~"但是这些功能应该可以用API解决,
    使用shell调用DOS命令是很简单,
    但是往往不是个好的办法。
      

  2.   

    win2k 下吗? 那很容易啊 dim user as string 
     dim msg as string'给字符串赋值 shell "net send " & user  & " " & msg 
      

  3.   

    我是想编写类似net send 功能的程序,而不是如何调用这个命令。
      

  4.   

    Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (Server As Any, yToName As Byte, yFromName As Any, yMsg As Byte, ByVal lSize As Long) As Long
    Private Function SendMsg(sToUser As String, sFromUser As String, sMessage As String) As Boolean
        Dim yToName() As Byte
        Dim yFromName() As Byte
        Dim yMsg() As Byte
        Dim l As Long
        On Error Resume Next
        If Trim(TxtMsg.Text) = "" Then Exit Function
        yToName = sToUser & vbNullChar
        yFromName = sFromUser & vbNullChar
        yMsg = sMessage & vbNullChar
        If NetMessageBufferSend(ByVal 0&, yToName(0), ByVal 0&, yMsg(0), UBound(yMsg)) = NERR_Success Then
            SendMsg = True
            If Timer1.Enabled = False Then
                 MessageNum = MessageNum + 1
                 MessageNow = MessageNum
                 OldMessage(MessageNum - 1) = TxtMsg.Text
                 If MessageNum = 50 Then ChangeGroup
                 ChangeList
                 TxtMsg.Text = ""
            End If
        End If
    End Function这是我做的一个函数,你把不必要的弄掉,这个专门是给局域网络发信息用的,实现的就是Net Send功能,需要代码
    [email protected],说明需要的东西;
      

  5.   

    to lovingkiss(你要答案我要分) :
    很好,能不能告诉说说在能够自己在程序中"截获"别人通过这种"信使服务"的方式发来的消息啊