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

📄 frmmain.vb

📁 empp 开发例子
💻 VB
字号:
Option Strict Off
Option Explicit On
Friend Class frmMain
	Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'对于启动窗体,所创建的第一个实例为默认实例。
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'此调用是 Windows 窗体设计器所必需的。
		InitializeComponent()
	End Sub
	'窗体重写处置,以清理组件列表。
	Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Windows 窗体设计器所必需的
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents Frame1 As System.Windows.Forms.GroupBox
	Public WithEvents txtMsg As System.Windows.Forms.TextBox
	Public WithEvents txtReceiver As System.Windows.Forms.TextBox
	Public WithEvents cmdClose As System.Windows.Forms.Button
	Public WithEvents cmdSend As System.Windows.Forms.Button
	Public WithEvents Label2 As System.Windows.Forms.Label
	Public WithEvents Label1 As System.Windows.Forms.Label
	'注意: 以下过程是 Windows 窗体设计器所必需的
	'可以使用 Windows 窗体设计器来修改它。
	'不要使用代码编辑器修改它。
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain))
		Me.components = New System.ComponentModel.Container()
		Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
		Me.ToolTip1.Active = True
		Me.Frame1 = New System.Windows.Forms.GroupBox
		Me.txtMsg = New System.Windows.Forms.TextBox
		Me.txtReceiver = New System.Windows.Forms.TextBox
		Me.cmdClose = New System.Windows.Forms.Button
		Me.cmdSend = New System.Windows.Forms.Button
		Me.Label2 = New System.Windows.Forms.Label
		Me.Label1 = New System.Windows.Forms.Label
		Me.Text = "Form1"
		Me.ClientSize = New System.Drawing.Size(443, 308)
		Me.Location = New System.Drawing.Point(4, 30)
		Me.Font = New System.Drawing.Font("宋体", 9!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me.MaximizeBox = False
		Me.MinimizeBox = False
		Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
		Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
		Me.BackColor = System.Drawing.SystemColors.Control
		Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable
		Me.ControlBox = True
		Me.Enabled = True
		Me.KeyPreview = False
		Me.Cursor = System.Windows.Forms.Cursors.Default
		Me.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.ShowInTaskbar = True
		Me.HelpButton = False
		Me.WindowState = System.Windows.Forms.FormWindowState.Normal
		Me.Name = "frmMain"
		Me.Frame1.Size = New System.Drawing.Size(441, 9)
		Me.Frame1.Location = New System.Drawing.Point(0, 256)
		Me.Frame1.TabIndex = 6
		Me.Frame1.BackColor = System.Drawing.SystemColors.Control
		Me.Frame1.Enabled = True
		Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Frame1.Visible = True
		Me.Frame1.Name = "Frame1"
		Me.txtMsg.AutoSize = False
		Me.txtMsg.Size = New System.Drawing.Size(425, 177)
		Me.txtMsg.Location = New System.Drawing.Point(8, 80)
		Me.txtMsg.TabIndex = 3
		Me.txtMsg.Text = "test"
		Me.txtMsg.AcceptsReturn = True
		Me.txtMsg.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
		Me.txtMsg.BackColor = System.Drawing.SystemColors.Window
		Me.txtMsg.CausesValidation = True
		Me.txtMsg.Enabled = True
		Me.txtMsg.ForeColor = System.Drawing.SystemColors.WindowText
		Me.txtMsg.HideSelection = True
		Me.txtMsg.ReadOnly = False
		Me.txtMsg.Maxlength = 0
		Me.txtMsg.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.txtMsg.MultiLine = False
		Me.txtMsg.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.txtMsg.ScrollBars = System.Windows.Forms.ScrollBars.None
		Me.txtMsg.TabStop = True
		Me.txtMsg.Visible = True
		Me.txtMsg.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
		Me.txtMsg.Name = "txtMsg"
		Me.txtReceiver.AutoSize = False
		Me.txtReceiver.Size = New System.Drawing.Size(425, 25)
		Me.txtReceiver.Location = New System.Drawing.Point(8, 24)
		Me.txtReceiver.TabIndex = 1
		Me.txtReceiver.Text = "13817599235"
		Me.txtReceiver.AcceptsReturn = True
		Me.txtReceiver.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
		Me.txtReceiver.BackColor = System.Drawing.SystemColors.Window
		Me.txtReceiver.CausesValidation = True
		Me.txtReceiver.Enabled = True
		Me.txtReceiver.ForeColor = System.Drawing.SystemColors.WindowText
		Me.txtReceiver.HideSelection = True
		Me.txtReceiver.ReadOnly = False
		Me.txtReceiver.Maxlength = 0
		Me.txtReceiver.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.txtReceiver.MultiLine = False
		Me.txtReceiver.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.txtReceiver.ScrollBars = System.Windows.Forms.ScrollBars.None
		Me.txtReceiver.TabStop = True
		Me.txtReceiver.Visible = True
		Me.txtReceiver.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
		Me.txtReceiver.Name = "txtReceiver"
		Me.cmdClose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me.cmdClose.Text = "关  闭(&C)"
		Me.cmdClose.Size = New System.Drawing.Size(81, 25)
		Me.cmdClose.Location = New System.Drawing.Point(344, 272)
		Me.cmdClose.TabIndex = 5
		Me.cmdClose.BackColor = System.Drawing.SystemColors.Control
		Me.cmdClose.CausesValidation = True
		Me.cmdClose.Enabled = True
		Me.cmdClose.ForeColor = System.Drawing.SystemColors.ControlText
		Me.cmdClose.Cursor = System.Windows.Forms.Cursors.Default
		Me.cmdClose.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.cmdClose.TabStop = True
		Me.cmdClose.Name = "cmdClose"
		Me.cmdSend.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me.cmdSend.Text = "发  送(&S)"
		Me.AcceptButton = Me.cmdSend
		Me.cmdSend.Size = New System.Drawing.Size(81, 25)
		Me.cmdSend.Location = New System.Drawing.Point(232, 272)
		Me.cmdSend.TabIndex = 4
		Me.cmdSend.BackColor = System.Drawing.SystemColors.Control
		Me.cmdSend.CausesValidation = True
		Me.cmdSend.Enabled = True
		Me.cmdSend.ForeColor = System.Drawing.SystemColors.ControlText
		Me.cmdSend.Cursor = System.Windows.Forms.Cursors.Default
		Me.cmdSend.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.cmdSend.TabStop = True
		Me.cmdSend.Name = "cmdSend"
		Me.Label2.Text = "短信内容(&M):"
		Me.Label2.Size = New System.Drawing.Size(81, 17)
		Me.Label2.Location = New System.Drawing.Point(16, 64)
		Me.Label2.TabIndex = 2
		Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopLeft
		Me.Label2.BackColor = System.Drawing.SystemColors.Control
		Me.Label2.Enabled = True
		Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label2.UseMnemonic = True
		Me.Label2.Visible = True
		Me.Label2.AutoSize = False
		Me.Label2.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label2.Name = "Label2"
		Me.Label1.Text = "收信人(&R):"
		Me.Label1.Size = New System.Drawing.Size(73, 17)
		Me.Label1.Location = New System.Drawing.Point(16, 8)
		Me.Label1.TabIndex = 0
		Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopLeft
		Me.Label1.BackColor = System.Drawing.SystemColors.Control
		Me.Label1.Enabled = True
		Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label1.UseMnemonic = True
		Me.Label1.Visible = True
		Me.Label1.AutoSize = False
		Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label1.Name = "Label1"
		Me.Controls.Add(Frame1)
		Me.Controls.Add(txtMsg)
		Me.Controls.Add(txtReceiver)
		Me.Controls.Add(cmdClose)
		Me.Controls.Add(cmdSend)
		Me.Controls.Add(Label2)
		Me.Controls.Add(Label1)
	End Sub
#End Region 
#Region "升级支持"
	Private Shared m_vb6FormDefInstance As frmMain
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmMain
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmMain()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	Private Sub cmdClose_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdClose.Click
		msgCtrl.cn.disconnect()
		Me.Close()
	End Sub
	
	Private Sub cmdSend_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSend.Click
		Dim a As Object
		Dim msg As New EMPPLib.ShortMessage
		Dim mobiles As New EMPPLib.Mobiles
		
		For	Each a In Split(txtReceiver.Text, ",")
			'UPGRADE_WARNING: 未能解析对象 a 的默认属性。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"”
			mobiles.Add(a)
		Next a
		
		
		'mobiles.Add txtReceiver.Text
		
		msg.DestMobiles = mobiles
		msg.content = txtMsg.Text
		msg.needStatus = True '需要状态报告
		msg.ServiceID = "0996340900" 'ServiceID随帐号帐号不同而改变,请在此处填写自己正确的ServiceID值
		msg.SendNow = True
		msg.srcID = msgCtrl.cn.AccountID
		msg.SequenceID = 123
		
		
		msgCtrl.cn.needStatus = True '需要状态报告,真正起作用的是这个属性
		If msgCtrl.cn.connected Then
			msgCtrl.cn.submit(msg)
		End If
		
		txtMsg.Text = ""
		
		'UPGRADE_NOTE: 在对对象 mobiles 进行垃圾回收前,不可以销毁该对象。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"”
		mobiles = Nothing
		'UPGRADE_NOTE: 在对对象 msg 进行垃圾回收前,不可以销毁该对象。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"”
		msg = Nothing
		
	End Sub
End Class

⌨️ 快捷键说明

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