tranhung
February 28th, 2004, 12:18 AM
I create DLL in VC :
-------Code-------------
int __stdcall HN72TOVN99_70( double ll0,double ll0new, int sonar,char inStr[100], int j, char outStr1[100])
{
int iResult = 0;
char rName[50], rIndex[50], rB[50], rL[50], rH[50],rX[50], rY[50];
CCalculate m_cal ;
int fE = m_cal.XYResult(inStr,rName,rIndex,rX,rY);
if ( ( fE == 0) )
{
double XX,YY, BB, LL;
double BB99, LL99, X99, Y99;
sscanf(rX,"%lf",&XX); sscanf(rY,"%lf",&YY);
double a0, a2, a4, a6;
m_cal.A_HESO(AK,EK, &a0, &a2 ,& a4, &a6);
m_cal.XY_BL(AK,EK, EPK, a0, a2, a4, a6, XX, YY, ll0, &BB, &LL );
m_cal.TinhHN72_70(XX,YY,BB, LL, &BB99, &LL99, &iResult);
m_cal.A_HESO(AW,EW, &a0, &a2 ,& a4, &a6);
m_cal.BL_XY(AW, EW, EPW, a0, a2, a4, a6, BB99, LL99, ll0new, sonar,1,&X99, &Y99);
if ( iResult == 1 )
//return sprintf(outStr1,"\t%02d\t%s\t%s\n",j+1,rName,rIndex);
return sprintf(outStr1,"\t%s\t%s\t%12.3lf\t%11.3lf\t%12.3lf\t%11.3lf\t\n",rName,rIndex, XX,YY,X99,Y99);
else
return sprintf(outStr1,"\t%s\t%s\tCan not calculate this point\n", rName, rIndex);
}
}
------------------------------
Call it in VB :
Public Declare Function HN72TOVN99_70 Lib "dll.dll" (ByVal ll0 As Double, ByVal ll0new As Double, ByVal sonar As Long, ByVal inStr As String, ByVal j As Long, ByVal outStr1 As String) As Long
Dim cnt As Long
Dim oS1 As String
oS1 = Space$(128)
cnt = HN72TOVN99_70(kt1, kt2, 6, strL, 1, oS1)
oS1 = Left$(oS1, cnt)
' kt1,kt2,strL : Input
When i debug in VC outStr1 return correct.
But when i run VB program oS1 return blank.
Can you help me ?
Thanks .
-------Code-------------
int __stdcall HN72TOVN99_70( double ll0,double ll0new, int sonar,char inStr[100], int j, char outStr1[100])
{
int iResult = 0;
char rName[50], rIndex[50], rB[50], rL[50], rH[50],rX[50], rY[50];
CCalculate m_cal ;
int fE = m_cal.XYResult(inStr,rName,rIndex,rX,rY);
if ( ( fE == 0) )
{
double XX,YY, BB, LL;
double BB99, LL99, X99, Y99;
sscanf(rX,"%lf",&XX); sscanf(rY,"%lf",&YY);
double a0, a2, a4, a6;
m_cal.A_HESO(AK,EK, &a0, &a2 ,& a4, &a6);
m_cal.XY_BL(AK,EK, EPK, a0, a2, a4, a6, XX, YY, ll0, &BB, &LL );
m_cal.TinhHN72_70(XX,YY,BB, LL, &BB99, &LL99, &iResult);
m_cal.A_HESO(AW,EW, &a0, &a2 ,& a4, &a6);
m_cal.BL_XY(AW, EW, EPW, a0, a2, a4, a6, BB99, LL99, ll0new, sonar,1,&X99, &Y99);
if ( iResult == 1 )
//return sprintf(outStr1,"\t%02d\t%s\t%s\n",j+1,rName,rIndex);
return sprintf(outStr1,"\t%s\t%s\t%12.3lf\t%11.3lf\t%12.3lf\t%11.3lf\t\n",rName,rIndex, XX,YY,X99,Y99);
else
return sprintf(outStr1,"\t%s\t%s\tCan not calculate this point\n", rName, rIndex);
}
}
------------------------------
Call it in VB :
Public Declare Function HN72TOVN99_70 Lib "dll.dll" (ByVal ll0 As Double, ByVal ll0new As Double, ByVal sonar As Long, ByVal inStr As String, ByVal j As Long, ByVal outStr1 As String) As Long
Dim cnt As Long
Dim oS1 As String
oS1 = Space$(128)
cnt = HN72TOVN99_70(kt1, kt2, 6, strL, 1, oS1)
oS1 = Left$(oS1, cnt)
' kt1,kt2,strL : Input
When i debug in VC outStr1 return correct.
But when i run VB program oS1 return blank.
Can you help me ?
Thanks .