0
我有一個遺留項目是寫在很多年前,用VB6編寫的。由於VB 6太舊,我無法在Google上找到VB 6的足夠信息。我做錯了,我從VB6調用dll
我想從VB 6中調用一個用VC++編寫的DLL。問題是VB調用DLL時,VB已經崩潰。我認爲這是DLL的錯誤,然後我調試DLL。但是,我發現該DLL工作正常。它最終返回0,但VB傳遞雙數組不成功,但是DLL工作正常。然後當DLL執行完畢並返回到VB時,VB就會崩潰。我無法弄清楚發生了什麼。任何想法?
這裏是我的VB代碼
Declare Function parseexcel Lib "parseexcelct.dll" (ByVal thepath As String, ByRef total() As Double, ByRef xy() As Double, ByRef ylxx() As Double, ByRef zy() As Double, ByRef zcy() As Double, ByRef gj1 As Double, ByRef gj2 As Double, ByRef xs1 As Double, ByRef xs2 As Double, ByVal gjt1 As Double, ByVal gjt2 As Double, ByVal xst1 As Double, ByVal xst2 As Double) As Long
Dim mypathstr As String
Dim total(0 To 20) As Double
Dim xy(0 To 20) As Double
Dim ylxx(0 To 20) As Double
Dim zy(0 To 20) As Double
Dim zcy(0 To 20) As Double
Dim gj1 As Double, gj2 As Double, xs1 As Double, xs2 As Double, gjt1 As Double
Dim gjt2 As Double, xst1 As Double, xst2 As Double
Dim result As Integer
mypathstr = CommonDialog.FileName
Dim i As Integer
'try to initial the array
For i = 0 To 20
total(i) = 1.1
xy(i) = 1.1
ylxx(i) = 1.1
zy(i) = 1.1
zcy(i) = 1.1
Next i
result = 0
gj1 = 1.1
gj2 = 1.1
xs1 = 1.1
xs2 = 1.1
gjt1 = 1.1
gjt2 = 1.1
xst1 = 1.1
xst2 = 1.1
result = parseexcel(mypathstr, total(), xy(), ylxx(), zy(), zcy(), gj1, gj2, xs1, xs2, gjt1, gjt2, xst1, xst2)'program have crashed here
DLL功能
int __stdcall parseexcel(const char * thepath,double * total,double * xy,double * ylxx,double * zy,double * zcy,double & gj1,double & gj2,double & xs1,double & xs2,double gjt1,double gjt2,double xst1,double xst2 )
我做了什麼錯?
[Here](https://msdn.microsoft.com/en-us/library/aa338032(v = VS.60).aspx)是MSDN VB6參考庫的(隱藏)鏈接。如你所見,微軟已經竭盡全力使VB6文檔難以找到。 – BobRodes