|
分類:[VB6 以前]
お世話になります。 VB6からVC++6のDLLの呼出しについて教えてください。 先日こちらで教えて頂いてまだ途中だったのですが、呼出し方法が変わり状況が変わったために新たにトピックを作らせて頂きました。 VCで計算した結果をVBで取得しているのですが、授受の過程で数値(配列)が大幅に変わってしまいます。(VCの計算結果ファイルの数値と、VBでVCから取得したあとの取得結果ファイルの数値が違ってしまう)VCの問題でなくて、VBの呼出し上の問題でそのようなことがおこるでしょうか? ご回答宜しくお願い致します。
******************VB側*********************** ' 構造体 Public Type Worm_Info aModule As Double aAturyokuKaku As Double aSusumiKaku As Double aHamotoChokkei As Double aPitchCircular As Double aOuterDiameter As Double aMizoHaba As Double aSaitanKyori As Double aKuitigaiKaku As Double aPoints_No As Long aBunkatuSuu As Long aObjectKind As Long aPts1(127) As Double aPts2(127) As Double End Type
Public Type Initial_Parameters aCalc_Tolerance As Double aShape_Base_Length As Double aMaxDevideNumber As Long aDebugMode As Boolean End Type
Public Type Correction_Parameters aCorrection_A As Double aCorrection_B As Double aCorrection_Kind_Flag As Long aPoint_no As Long aPts1(256) As Double aPts2(256) As Double End Type
'関数定義 Private Declare Function Calc_Top Lib "HMTS.dll" () As Long Private Declare Function Initial_Parameter_Setting Lib "HMTS.dll" (ByRef pData As Initial_Parameters) As Long Private Declare Function Struct_Data_Setting_For_Correction Lib "HMTS.dll" (ByRef pData As Correction_Parameters) As Long Private Declare Function Struct_Data_Setting_For_Worm Lib "HMTS.dll" (ByRef pData As Worm_Info) As Long
'以下呼出し部(Textは設定済) Dim nRet As Long Dim ST_Worm_Info As Worm_Info Dim ST_Initial_Parameters As Initial_Parameters Dim ST_Dendum_Correction As Correction_Parameters Dim ST_Addendum_Correction As Correction_Parameters Dim lngCount As Long With ST_Initial_Parameters .aMaxDevideNumber = Text22 .aCalc_Tolerance = Text23 .aShape_Base_Length = Text24 .aDebugMode = Text25 End With With ST_Dendum_Correction .aCorrection_Kind_Flag = 0 .aCorrection_A = Text26 .aCorrection_B = Text27 End With With ST_Worm_Info .aModule = Text11 .aAturyokuKaku = Text12 .aSusumiKaku = Text13 .aHamotoChokkei = Text14 .aPitchCircular = Text15 .aOuterDiameter = Text16 .aMizoHaba = Text17 .aSaitanKyori = Text18 .aKuitigaiKaku = Text19 .aBunkatuSuu = Text20 .aObjectKind = Text21 End With With ST_Addendum_Correction .aCorrection_Kind_Flag = 3 .aCorrection_A = Text28 .aCorrection_B = Text29 End With
nRet = Initial_Parameter_Setting(ST_Initial_Parameters) nRet = Struct_Data_Setting_For_Correction(ST_Dendum_Correction) nRet = Struct_Data_Setting_For_Worm(ST_Worm_Info) nRet = Struct_Data_Setting_For_Correction(ST_Addendum_Correction) nRet = Calc_Top()
intFileNo = FreeFile Open "sampletest.csv" For Output As #intFileNo For lngCount = 0 To 255 Write #intFileNo, ST_Dendum_Correction.aPts1(lngCount), _ ←この部分の結果はOK ST_Dendum_Correction.aPts2(lngCount) Next lngCount For lngCount = 0 To 127 Write #intFileNo, ST_Worm_Info.aPts1(lngCount), _ ←この部分の結果が違う ST_Worm_Info.aPts2(lngCount), ST_Worm_Info.aPoints_No Next lngCount For lngCount = 0 To 255 Write #intFileNo, ST_Addendum_Correction.aPts1(lngCount), _ ←この部分の結果もOK ST_Addendum_Correction.aPts2(lngCount) Next lngCount Close #intFileNo
|