Click to See Complete Forum and Search --> : MaMut help me !!!


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 .

Sam Hobbs
February 28th, 2004, 10:41 PM
Who is MaMut? You seem to be getting no help from MaMut.

I searched this forum for "Public Declare Function" and there are four other threads that were found by that. You can use other keywords to search with also. Also search the VC forum. Aslo, if you search the VB forum, then you can use keywords from C/C++ to search for, such as "char". I think it is likely there are enough samples to help you.

Aslo, search the VC documentation for VB stuff. I know there is a page that shows the VB equivalent for VC types.

Andreas Masur
February 29th, 2004, 01:39 AM
Take a look at the following FAQ (http://www.codeguru.com/forum/showthread.php?s=&threadid=231254)...

mamut
March 2nd, 2004, 01:14 AM
Oh la la,
I found no mistake from your code...
Hmm, try increasing your output buffer, and/or removing "\t" character from the beginning of sprintf's format pattern.

tranhung
March 2nd, 2004, 02:14 AM
Hi Mamut
Help me!!!
Thanks

tranhung
March 5th, 2004, 02:35 AM
Mamut try help me !!!!!!!!!!!!!!!!!!

mamut
March 5th, 2004, 05:17 AM
Try using char * instead of char[] in function's argument.

int __stdcall HN72TOVN99_70( double ll0,double ll0new, int sonar,char *inStr, int j, char *outStr1)

tranhung
March 8th, 2004, 10:13 PM
Hi mamut !
I've done flow you but String output empty.

tranhung
March 11th, 2004, 01:07 AM
Mamut, where are you, try help me !!!

mamut
March 11th, 2004, 01:28 AM
Surrender!

tranhung
March 17th, 2004, 02:59 AM
Mamut help me !!!!!!!!!!!!!!!!!!!!!