⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 主要是网络和数据库的一些东东
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "在局域网内发送信息"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "退出程序"
      Height          =   405
      Left            =   2160
      TabIndex        =   6
      Top             =   2640
      Width           =   1335
   End
   Begin VB.TextBox TxtMsg 
      Height          =   1410
      HideSelection   =   0   'False
      Left            =   495
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   3
      Top             =   975
      Width           =   3675
   End
   Begin VB.TextBox TxtTo 
      Height          =   360
      Left            =   2565
      TabIndex        =   2
      Top             =   435
      Width           =   1590
   End
   Begin VB.TextBox TxtFrom 
      Height          =   360
      Left            =   495
      TabIndex        =   1
      Top             =   420
      Width           =   1590
   End
   Begin VB.CommandButton Command1 
      Caption         =   "发送"
      Height          =   405
      Left            =   840
      TabIndex        =   0
      Top             =   2640
      Width           =   1335
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "到"
      Height          =   180
      Left            =   2250
      TabIndex        =   5
      Top             =   495
      Width           =   180
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "从"
      Height          =   180
      Left            =   165
      TabIndex        =   4
      Top             =   510
      Width           =   180
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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 Sub Command1_Click()
    Dim X As Boolean
    X = SendMsg(TxtTo.Text, TxtFrom.Text, TxtMsg.Text)
    If X Then
        MsgBox "消息已被成功发送", vbInformation, "发送消息"
    Else
        MsgBox "发送消息失败", vbCritical, "发送消息"
    End If
End Sub

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
    
    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
    End If
End Function

Private Sub Command2_Click()
    End
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -