CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Feb 2004
    Posts
    18

    Lightbulb MaMut help me !!!

    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 .

  2. #2
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    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.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Take a look at the following FAQ...

  4. #4
    Join Date
    Feb 2003
    Posts
    35
    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.

  5. #5
    Join Date
    Feb 2004
    Posts
    18
    Hi Mamut
    Help me!!!
    Thanks

  6. #6
    Join Date
    Feb 2004
    Posts
    18
    Mamut try help me !!!!!!!!!!!!!!!!!!

  7. #7
    Join Date
    Feb 2003
    Posts
    35
    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)

  8. #8
    Join Date
    Feb 2004
    Posts
    18
    Hi mamut !
    I've done flow you but String output empty.

  9. #9
    Join Date
    Feb 2004
    Posts
    18
    Mamut, where are you, try help me !!!

  10. #10
    Join Date
    Feb 2003
    Posts
    35

    Unhappy

    Surrender!

  11. #11
    Join Date
    Feb 2004
    Posts
    18
    Mamut help me !!!!!!!!!!!!!!!!!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured