
正文
vb.net电话拨号 vbnet call
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VB.NET如何使用(MODEM)指令,不用MSCOMM控件。
看来你是想用VB.NET做一个上位机界面来控制你的MODEM吧,MODEM是通过AT指令实现,VB中没有现成的AT指令集,而且一般来说需要通过串口向你的MODEM发送AT指令使其工作。所以你说的在VB.NET中直接调用AT指令集无法实现的。
MSCOMM控件是VB6.0中的串口通信控件,在VB.NET中你需要用到SerialPort控件(跟MSCOMM差不多)。
相关问答
Q1: 我想用vb.net获得电话交换机的来电显示,可是却不知道从何下手,网上所说的MSComm1控件该如何用呢?
MSCOMM是VB6.0和VC6.0中的串口控件,VB.NET中是SerialPort。MSDN上可以找到相关的资料,网上也有很多例程
Q2: VB如何实现连接宽带上网或者调用DOS实现拨号上网
'[VB6]创建"宽带连接"源码
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Private Type RASIPADDR
a As Byte
b As Byte
c As Byte
d As Byte
End Type
Private Type RASENTRY
dwSize As Long
dwfOptions As Long
dwCountryID As Long
dwCountryCode As Long
szAreaCode(10) As Byte
szLocalPhoneNumber(128) As Byte
dwAlternateOffset As Long
ipaddr As RASIPADDR
ipaddrDns As RASIPADDR
ipaddrDnsAlt As RASIPADDR
ipaddrWins As RASIPADDR
ipaddrWinsAlt As RASIPADDR
dwFrameSize As Long
dwfNetProtocols As Long
dwFramingProtocol As Long
szScript(259) As Byte
szAutodialDll(259) As Byte
szAutodialFunc(259) As Byte
szDeviceType(16) As Byte
szDeviceName(128) As Byte
szX25PadType(32) As Byte
szX25Address(200) As Byte
szX25Facilities(200) As Byte
szX25UserData(200) As Byte
dwChannels As Long
dwReserved1 As Long
dwReserved2 As Long
dwSubEntries As Long
dwDialMode As Long
dwDialExtraPercent As Long
dwDialExtraSampleSeconds As Long
dwHangUpExtraPercent As Long
dwHangUpExtraSampleSeconds As Long
dwIdleDisconnectSeconds As Long
dwType As Long
dwEncryptionType As Long
dwCustomAuthKey As Long
guidId As GUID
szCustomDialDll(259) As Byte
dwVpnStrategy As Long
dwfOptions2 As Long
dwfOptions3 As Long
szDnsSuffix(255) As Byte
dwTcpWindowSize As Long
szPrerequisitePbk(259) As Byte
szPrerequisiteEntry(256) As Byte
dwRedialCount As Long
dwRedialPause As Long
End Type
Private Type RASCREDENTIALS
dwSize As Long
dwMask As Long
szUserName(256) As Byte
szPassword(256) As Byte
szDomain(15) As Byte
End Type
Private Declare Function RasSetEntryProperties Lib "rasapi32" Alias "RasSetEntryPropertiesA" (ByVal lpszPhonebook As String, ByVal lpszEntry As String, lpRasEntry As RASENTRY, ByVal dwEntryInfoSize As Long, ByVal lpbDeviceInfo As Long, ByVal dwDeviceInfoSize As Long) As Long
Private Declare Function RasSetCredentials Lib "rasapi32" Alias "RasSetCredentialsA" (ByVal lpszPhonebook As String, ByVal lpszEntry As String, lpCredentials As RASCREDENTIALS, ByVal fClearCredentials As Long) As Long
Function Create_PPPoE_Connection(ByVal sEntryName As String, ByVal sUsername As String, ByVal sPassword As String) As Boolean
Create_PPPoE_Connection = False
Dim re As RASENTRY
Dim sDeviceName As String, sDeviceType As String
sDeviceName = "WAN 微型端口 (PPPOE)"
sDeviceType = "PPPoE"
With re
.dwSize = LenB(re)
.dwCountryCode = 86
.dwCountryID = 86
.dwDialExtraPercent = 75
.dwDialExtraSampleSeconds = 120
.dwDialMode = 1
.dwEncryptionType = 3
.dwfNetProtocols = 4
.dwfOptions = 1024262928
.dwfOptions2 = 367
.dwFramingProtocol = 1
.dwHangUpExtraPercent = 10
.dwHangUpExtraSampleSeconds = 120
.dwRedialCount = 3
.dwRedialPause = 60
.dwType = 5
CopyMemory .szDeviceName(0), ByVal sDeviceName, Len(sDeviceName)
CopyMemory .szDeviceType(0), ByVal sDeviceType, Len(sDeviceType)
End With
Dim rc As RASCREDENTIALS
With rc
.dwSize = LenB(rc)
.dwMask = 11
CopyMemory .szUserName(0), ByVal sUsername, Len(sUsername)
CopyMemory .szPassword(0), ByVal sPassword, Len(sPassword)
End With
Dim rtn As Long
If RasSetEntryProperties(vbNullString, sEntryName, re, LenB(re), 0, 0) = 0 Then
If RasSetCredentials(vbNullString, sEntryName, rc, 0) = 0 Then
Create_PPPoE_Connection = True
End If
End If
End Function
Private Sub Command1_Click()
Dim sEntryName As String, sUsername As String, sPassword As String
sEntryName = "宽带连接2"
sUsername = "用户名"
sPassword = "密码"
If Create_PPPoE_Connection(sEntryName, sUsername, sPassword) Then
MsgBox "连接建立成功!"
Else
MsgBox "连接建立失败!"
End If
End Sub
Q3: 关于VB.NET中的call
没什么区别,只是增加可读性而已,以下是摘自MSDN的说明:
Visual Basic 语言参考
Call 语句 (Visual Basic)
将控制传送到 Function、Sub 或动态链接库 (DLL) 过程。
[ Call ] procedureName [ (argumentList) ]
各部分说明
procedureName
必选。要调用的过程名。
argumentList
可选。变量和表达式列表,表示当调用过程时传递给该过程的参数。多个参数以逗号分隔。如果包括 argumentList,则必须将它放在括号内。
备注
您通常使用 Call 语句调用不返回值的过程。如果该过程返回值,Call 语句将放弃该值。
在调用过程时不要求您必须使用 Call 语句,但使用该语句可以提高代码的可读性。
Q4: vb.net 怎么声明API
不会这个APIvb.net电话拨号,不过提醒下vb.net电话拨号,.netvb.net电话拨号的API声明类型都为Integervb.net电话拨号,不是Long
Q5: VB.NET怎样做拨号连接?
Imports System.Drawing.Imaging.ImageFormat
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
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
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem8 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem9 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem10 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem11 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem12 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem13 As System.Windows.Forms.MenuItem
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.MenuItem2 = New System.Windows.Forms.MenuItem
Me.MenuItem3 = New System.Windows.Forms.MenuItem
Me.MenuItem5 = New System.Windows.Forms.MenuItem
Me.MenuItem6 = New System.Windows.Forms.MenuItem
Me.MenuItem4 = New System.Windows.Forms.MenuItem
Me.MenuItem7 = New System.Windows.Forms.MenuItem
Me.MenuItem8 = New System.Windows.Forms.MenuItem
Me.MenuItem9 = New System.Windows.Forms.MenuItem
Me.MenuItem10 = New System.Windows.Forms.MenuItem
Me.MenuItem11 = New System.Windows.Forms.MenuItem
Me.MenuItem12 = New System.Windows.Forms.MenuItem
Me.MenuItem13 = New System.Windows.Forms.MenuItem
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Button4 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem4, Me.MenuItem9, Me.MenuItem12})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2, Me.MenuItem3, Me.MenuItem5, Me.MenuItem6})
Me.MenuItem1.Text = "文件"
'
'MenuItem2
'
Me.MenuItem2.Index = 0
Me.MenuItem2.Text = "打开"
'
'MenuItem3
'
Me.MenuItem3.Index = 1
Me.MenuItem3.Text = "关闭"
'
'MenuItem5
'
Me.MenuItem5.Index = 2
Me.MenuItem5.Text = "保存"
'
'MenuItem6
'
Me.MenuItem6.Index = 3
Me.MenuItem6.Text = "退出"
'
'MenuItem4
'
Me.MenuItem4.Index = 1
Me.MenuItem4.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem7, Me.MenuItem8})
Me.MenuItem4.Text = "窗口"
'
'MenuItem7
'
Me.MenuItem7.Index = 0
Me.MenuItem7.MdiList = True
Me.MenuItem7.Text = "属性"
'
'MenuItem8
'
Me.MenuItem8.Index = 1
Me.MenuItem8.Text = "工具"
'
'MenuItem9
'
Me.MenuItem9.Index = 2
Me.MenuItem9.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem10, Me.MenuItem11})
Me.MenuItem9.Text = "工具"
'
'MenuItem10
'
Me.MenuItem10.Index = 0
Me.MenuItem10.Text = "中心定位"
'
'MenuItem11
'
Me.MenuItem11.Index = 1
Me.MenuItem11.Text = "选项"
'
'MenuItem12
'
Me.MenuItem12.Index = 3
Me.MenuItem12.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem13})
Me.MenuItem12.Text = "帮助"
'
'MenuItem13
'
Me.MenuItem13.Index = 0
Me.MenuItem13.Text = "关于"
'
'PictureBox1
'
Me.PictureBox1.BackColor = System.Drawing.SystemColors.Control
Me.PictureBox1.Enabled = False
Me.PictureBox1.Location = New System.Drawing.Point(88, 8)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(256, 168)
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Me.PictureBox1.TabIndex = 1
Me.PictureBox1.TabStop = False
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(8, 16)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(64, 56)
Me.Button1.TabIndex = 2
Me.Button1.Text = "中心定位"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(8, 80)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(64, 56)
Me.Button2.TabIndex = 3
Me.Button2.Text = "容错值:0"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Button4)
Me.GroupBox1.Controls.Add(Me.Button3)
Me.GroupBox1.Controls.Add(Me.Button2)
Me.GroupBox1.Controls.Add(Me.Button1)
Me.GroupBox1.Cursor = System.Windows.Forms.Cursors.Hand
Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Left
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(80, 473)
Me.GroupBox1.TabIndex = 4
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "功能"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(8, 208)
Me.Button4.Name = "Button4"
Me.Button4.TabIndex = 5
Me.Button4.Text = "Button4"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(8, 144)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(64, 56)
Me.Button3.TabIndex = 4
Me.Button3.Text = "显示过渡"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(800, 473)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.PictureBox1)
Me.Menu = Me.MainMenu1
Me.Name = "Form1"
Me.Text = "Form1"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim PropertyWindows As New 属性窗口
Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
'PropertyWindows.Parent = Me
'PropertyWindows.MdiParent = Me
PropertyWindows.Show()
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Dim Open As New OpenFileDialog
Open.Title = "选择图片"
Open.Filter = "全部|*.*|JPG(*.jpg)|*.jpg|BMP(*.bmp)|*.bmp|TIFF(*.Tiff)|*.Tiff|PNG(*.png)|*.png|ICO(*.ico)|*.ico"
If Open.ShowDialog = DialogResult.OK Then
Try
PictureBox1.Image = Image.FromStream(Open.OpenFile, True)
'确定类型
If PictureBox1.Image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp) Then
PropertyWindows.P1.Text = "Bmp"
ElseIf PictureBox1.Image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif) Then
PropertyWindows.P1.Text = "Gif"
ElseIf PictureBox1.Image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Icon) Then
PropertyWindows.P1.Text = "Ico"
ElseIf PictureBox1.Image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg) Then
PropertyWindows.P1.Text = "Jpg"
ElseIf PictureBox1.Image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png) Then
PropertyWindows.P1.Text = "Png"
End If
'确定黑白
'其它
PropertyWindows.P3.Text = PictureBox1.Image.PhysicalDimension.Width
PropertyWindows.P4.Text = PictureBox1.Image.PhysicalDimension.Height
PropertyWindows.P5.Text = PictureBox1.Image.HorizontalResolution
PropertyWindows.P6.Text = PictureBox1.Image.VerticalResolution
PictureBox1.Enabled = True '激活
Catch ex As Exception
MessageBox.Show("你打开的文件为无法识别的图像格式")
End Try
End If
End Sub
Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
Dim Save As New SaveFileDialog
Save.Title = "保存图片"
Save.Filter = "全部|*.*| JPG(*.jpg)|*.jpg|BMP(*.bmp)|*.bmp _|TIFF(*.Tiff)|*.Tiff|PNG(*.png)|*.png|ICO(*.ico)|*.ico"
If Save.ShowDialog = DialogResult.OK Then
Dim PicFormat As System.Drawing.Imaging.ImageFormat
Select Case Save.FilterIndex
Case 1
PicFormat = Jpeg
Case 2
PicFormat = Jpeg
Case 3
PicFormat = Bmp
Case 4
PicFormat = Tiff
Case 5
PicFormat = Png
Case 6
PicFormat = System.Drawing.Imaging.ImageFormat.Icon
End Select
PictureBox1.Image.Save(Save.FileName, PicFormat)
End If
End Sub
Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
End
End Sub
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
PictureBox1.Image = Nothing
'PictureBox1.Image.Dispose()
PropertyWindows.P1.Text = " "
PropertyWindows.P2.Text = " "
PropertyWindows.P3.Text = " "
PropertyWindows.P4.Text = " "
PropertyWindows.P5.Text = " "
PropertyWindows.P6.Text = " "
PictureBox1.Enabled = False '关闭激活
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PropertyWindows.Show()
Dim path As New System.IO.FileInfo("图像处理")
Me.Text = path.FullName
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
Dim a As Bitmap = PictureBox1.Image
PropertyWindows.P7.Text = a.GetPixel(e.X, e.Y).R
PropertyWindows.P8.Text = a.GetPixel(e.X, e.Y).G
PropertyWindows.P9.Text = a.GetPixel(e.X, e.Y).B
PropertyWindows.P10.Text = e.X
PropertyWindows.P11.Text = e.Y
End Sub
Private Sub MenuItem10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem10.Click
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Data.X1 = Data.X2 : Data.Y1 = Data.Y2
Data.X2 = PropertyWindows.P10.Text : Data.Y2 = PropertyWindows.P11.Text
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim RCoperation As New 容错值设置
If RCoperation.ShowDialog = DialogResult.OK Then
Button2.Text = "容错值:" Data.容错值
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim 定位 As New 中心定位(PictureBox1.Image)
定位.MyPic = PictureBox1.Image
PictureBox1.Image = 定位.Enter()
定位 = Nothing
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Data.Pic = PictureBox1.Image
Dim ShowTool As New 显示过渡工具
ShowTool.ShowDialog()
End Sub
Private Sub PictureBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.DoubleClick
Data.Pic = PictureBox1.Image
Dim ShowTool As New 显示过渡工具
ShowTool.Show()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
MessageBox.Show(Int(3 / 2))
End Sub
End Class
vb.net电话拨号的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vbnet call、vb.net电话拨号的信息别忘了在本站进行查找喔。








