Embedding a 3rd party .dll

Re: Embedding a 3rd party .dll

Postby Jeanette Panitz » Thu Oct 24, 2013 1:30 pm

Antonio,

unfortunately this solution does not work, the program crashes.

I tried this way also a week ago and the program works only like this, but does not fill the array of integer
Code: Select all  Expand view

PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
for ( k = 0; k < 30; k++ ) {
        aStruct.CSVFeld[k] = hb_arrayGetNI( pArray, k+1 );
}

The moment I am using another number than " 1 " the program does not work.

Is it possible to make something like that?
Code: Select all  Expand view
PHB_ITEM pArray = hb_param( 1, 17, HB_IT_ARRAY );
With best regards,
Jeanette

http://www.ctosoftware.de/
Jeanette Panitz
 
Posts: 10
Joined: Mon Oct 21, 2013 10:58 am
Location: Germany

Re: Embedding a 3rd party .dll

Postby Antonio Linares » Thu Oct 24, 2013 3:27 pm

Jeanette,

Please try this:

Code: Select all  Expand view

PHB_ITEM pArray = hb_param( 17, HB_IT_ARRAY );

if( ! pArray )
   MessageBox( 0, "not an array there", "ok", 0 );

...
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42094
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Embedding a 3rd party .dll

Postby Jeanette Panitz » Mon Oct 28, 2013 12:39 pm

Antonio,
I tried your solution: the program shows the message "not an array there". After that it crashes.

Code: Select all  Expand view

...
PHB_ITEM pArray = hb_param( 17, HB_IT_ARRAY );
...
if( ! pArray ) {
     MessageBox( 0, "not an array there", "ok", 0 );
}      
for ( k = 0; k < 30; k++ )
{
     aStruct.CSVFeld[k] = hb_arrayGetNI( pArray, k+1 );
}
...
 
With best regards,
Jeanette

http://www.ctosoftware.de/
Jeanette Panitz
 
Posts: 10
Joined: Mon Oct 21, 2013 10:58 am
Location: Germany

Re: Embedding a 3rd party .dll

Postby Antonio Linares » Mon Oct 28, 2013 1:34 pm

Jeanette,

This should be the right way:

Code: Select all  Expand view

PHB_ITEM pArray;

hb_arrayGet( hb_param( 1, HB_IT_ARRAY ), 17, pArray );

for ( k = 0; k < 30; k++ )
{
     aStruct.CSVFeld[k] = hb_arrayGetNI( pArray, k+1 );
}
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42094
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Embedding a 3rd party .dll

Postby Jeanette Panitz » Thu Oct 31, 2013 10:57 am

Thank you very much Antonio,

this solution works fine.

Do you also know how to return an array of integer?
I have another function (with 2 structs), that returns information of a xml-file.
If there are discrepancies in the xml-file the array of int "Hinweis[30]" should return error-codes.
Code: Select all  Expand view

// 34 SepaTools_XMLLesen with 2 structs
    typedef struct
    {
        int   Lastschrift;         
        int   SummeAnzahl;           
        char  SummeBetrag[12+1];   
        char  MsgId[35+1];         
        char  ErstDatum[8+1];      
        char  ErstZeit[8+1];       
        char  EinreicherName[70+1]
    } XMLGroupStruct34;
   
    typedef struct
    {  
        char  PmInfoId[35+1];        
        char  AusfDatum[8+1];        
        char  AuftragName[70+1];   
        char  AuftragBIC[11+1];    
        char  AuftragIBAN[35+1];   
        char  AuftragAbwName[70+1]
        char  AuftragCI[35+1];     
        char  EmpfName[70+1];      
        char  EmpfBIC[11+1];       
        char  EmpfIBAN[35+1];      
        char  EmpfAbwName[70+1];   
        char  Betrag[12+1];    
        char  EndToEndId[35+1];    
        char  MandatId[35+1];      
        char  MandatDatum[8+1];    
        char  SequenceType[4+1];   
        int   B2B;                 
        int   SammlerAnzahl;       
        char  SammlerSumme[12+1];   
        char  Zweck1[70+1];        
        char  Zweck2[70+1];        
        int   Hinweis[30];           
    } XMLReadStruct34;

    int pascal SepaTools_XMLLesen( const int *First, XMLGroupStruct34 *GroupStruct, XMLReadStruct34 *ReadStruct );
   
    HB_FUNC( SEPATOOLS_XMLLESEN )
    {
        int k;
        int iSize = hb_parni( 1 );
        XMLGroupStruct34 aStruct1;
        XMLReadStruct34  aStruct2;  
        int nReturn;
        PHB_ITEM pArray;

        nReturn = SepaTools_XMLLesen( &iSize, &aStruct1, &aStruct2 );
        hb_storni( iSize, 1 );
        hb_arraySet( hb_param( 2, HB_IT_ARRAY ), 23, pArray );
               
        hb_reta( 31 );
        hb_storni( aStruct1.Lastschrift, -1, 1 );
        hb_storni( aStruct1.SummeAnzahl, -1, 2 );
        hb_storc( aStruct1.SummeBetrag, -1, 3 );
        hb_storc( aStruct1.MsgId, -1, 4 );
        hb_storc( aStruct1.ErstDatum, -1, 5 );
        hb_storc( aStruct1.ErstZeit, -1, 6 );
        hb_storc( aStruct1.EinreicherName, -1, 7 );
        hb_storc( aStruct2.PmInfoId, -1, 8 );
        hb_storc( aStruct2.AusfDatum, -1, 9 );
        hb_storc( aStruct2.AuftragName, -1, 10 );
        hb_storc( aStruct2.AuftragBIC, -1, 11 );
        hb_storc( aStruct2.AuftragIBAN, -1, 12 );
        hb_storc( aStruct2.AuftragAbwName, -1, 13 );
        hb_storc( aStruct2.AuftragCI, -1, 14 );
        hb_storc( aStruct2.EmpfName, -1, 15 );
        hb_storc( aStruct2.EmpfBIC, -1, 16 );
        hb_storc( aStruct2.EmpfIBAN, -1, 17 );
        hb_storc( aStruct2.EmpfAbwName, -1, 18 );
        hb_storc( aStruct2.Purpose, -1, 19 );
        hb_storc( aStruct2.Betrag, -1, 20 );
        hb_storc( aStruct2.EndToEndId, -1, 21 );
        hb_storc( aStruct2.MandatId, -1, 22 );
        hb_storc( aStruct2.MandatDatum, -1, 23 );
        hb_storc( aStruct2.SequenceType, -1, 24 );
        hb_storni( aStruct2.B2B, -1, 25 );
        hb_storni( aStruct2.SammlerAnzahl, -1, 26 );
        hb_storc( aStruct2.SammlerSumme, -1, 27 );
        hb_storc( aStruct2.Zweck1, -1, 28 );
        hb_storc( aStruct2.Zweck2, -1, 29 );
        for ( k = 0; k < 30; k++ )
        {
            hb_storni( aStruct2.Hinweis[k],  -1, 30, k+1 );
        }
        hb_storni( nReturn, -1, 31 );
    }
 

The program runs, but I get always error-code "0" (in the array of int "Hinweis") even when I change the xml-file.
With best regards,
Jeanette

http://www.ctosoftware.de/
Jeanette Panitz
 
Posts: 10
Joined: Mon Oct 21, 2013 10:58 am
Location: Germany

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests