永州到太原的火车票:vb中调用dll出错!!高手请教呀!

来源:百度文库 编辑:神马品牌网 时间:2024/05/04 03:09:13
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

Public Sub New()
MyBase.New()

'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()

'在 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

'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Command1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Command1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Command1
'
Me.Command1.Location = New System.Drawing.Point(184, 136)
Me.Command1.Name = "Command1"
Me.Command1.TabIndex = 0
Me.Command1.Text = "Command1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Command1})
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
Private Declare Function OmrS Lib "OMRCLIEN.DLL" (ByVal buffer As String) As String
Private Declare Function OmrG Lib "OMRCLIEN.DLL" (ByVal buffer As String) As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click

Dim n As Object
Dim cmd As Object
Dim buffer As String
Dim v As String
Dim C As Boolean
C = True
'buffer = "105.txt/"
'OmrS(buffer)
'OmrG(buffer)
While C = True
buffer = "/ "
v = OmrS(buffer)
v = OmrG(buffer)
MsgBox(buffer)
If Microsoft.VisualBasic.Left(Trim(buffer), 2) = "OK" Then
buffer = "001" & Space(250) & "/"
OmrS(buffer)
OmrG(buffer)
MsgBox(buffer)
End If

End While
End Sub

End Class
运行上面代码是出现:

未处理的“System.Runtime.InteropServices.SEHException”类型的异常出现在 WindowsApplication1.exe 中
其他信息:外部组件发生异常。

试了很多次了。找不到原因??

我也不太懂,你水平比我高多了,不知道换个别的组件行不行?