Passing VB String array to DLL??? 
Author Message
 Passing VB String array to DLL???

I am writting a DLL in VC++ 4.0 for VB 4.0 32.  I want to be able to
pass a VB String array to the DLL, where it will modifiy the contents of
the VB string array
        I am unsure of how to use the array to be able to modify the contents
of each individual string.  Here is what I have so far.

STDAPI_(short) RecVBStrArray(const long vlTuning, SAFEARRAY **lpsa)
{
        SAFEARRAY *psa;
        BSTR *lptrStringArray;  

        if (!lpsa) return (-1);
        psa = *lpsa;

        if(!psa) return (-2);
        lptrStringArray = (BSTR *)psa->pvData;      

//  Causes an error, normally it should just remove the pointer and free
the old string
//      |
//      |
        SysFreeString(*lptrStringArray);  

        return (0);

Quote:
}

        I have tried using OLECHAR * instead of the SAFEARRAY type actual
argument, but I get errors when I try to pass anything to it.

        Any help would be greatly apperiecated, please e-mail me answers,
suggestions ect.  TIA

--

Andy

UU     UU          University of Cincinnati
UU     UU           Electrical Engineering
UU     UU               Class of 2000
UU     UU CCCCCC

  UUUUU CC
        CC
        CC              
         CCCCCCC
          CCCCCC



Sat, 12 Feb 2000 03:00:00 GMT  
 Passing VB String array to DLL???

I am writting a DLL in VC++ 4.0 for VB 4.0 32.  I want to be able to
pass a VB String array to the DLL, where it will modifiy the contents of
the VB string array
        I am unsure of how to use the array to be able to modify the contents
of each individual string.  Here is what I have so far.

STDAPI_(short) RecVBStrArray(const long vlTuning, SAFEARRAY **lpsa)
{
        SAFEARRAY *psa;
        BSTR *lptrStringArray;  

        if (!lpsa) return (-1);
        psa = *lpsa;

        if(!psa) return (-2);
        lptrStringArray = (BSTR *)psa->pvData;      

//  Causes an error, normally it should just remove the pointer and free
the old string
//      |
//      |
        SysFreeString(*lptrStringArray);  

        return (0);

Quote:
}

        I have tried using OLECHAR * instead of the SAFEARRAY type actual
argument, but I get errors when I try to pass anything to it.

        Any help would be greatly apperiecated, please e-mail me answers,
suggestions ect.  TIA

--

Andy

UU     UU          University of Cincinnati
UU     UU           Electrical Engineering
UU     UU               Class of 2000
UU     UU CCCCCC

  UUUUU CC
        CC
        CC              
         CCCCCCC
          CCCCCC



Sat, 12 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. passing (string) arrays from VB to C-DLL and vice versa

2. Passing array of strings to a dll in VB

3. passing (string) arrays from VB to C-DLL and vice versa

4. passing (string) arrays from VB to C-DLL and vice versa

5. How to pass a string Array from VB to a C++ DLL

6. Passing array from VB to DLL and returning array

7. how to pass a string array to mfc dll

8. Passing string Array from VB3 to DLL

9. Passing String Arrays to API DLLs

10. passing string arrays to dll

11. help with pass string array to C DLL procedure

12. Passing string Arrays from Fortran DLL to Visual Basic

 

 
Powered by phpBB® Forum Software