Re: "SafeArrayTypeMismatchException" - .NET MASTERS PLEASE HELP
- From: "Bryan Phillips" <bphillips@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 16 Jun 2007 22:52:23 +0000
You have to use ByRef for the arrays in order to pass them to the C++ function and get values back.
--
Bryan Phillips
MCT, MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Web Site: http://www.composablesystems.net
"Phoenix" <sudhansutiwari@xxxxxxxxx> wrote in message news:1181186922.481290.283150@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:
On Jun 6, 6:53 am, "Bryan Phillips"
<bphill...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> You need to give the marshalling code more information about how to pass
> data to your C++ function. Take a look at this:
>
> http://msdn2.microsoft.com/en-us/library/ms172514.aspx
>
> --
> Bryan Phillips
> MCT, MCSD, MCDBA, MCSE
> Blog: http://bphillips76.spaces.live.com
> Web Site: http://www.composablesystems.net
>
> "Phoenix" <sudhansutiw...@xxxxxxxxx> wrote in message
>
> news:1181056485.391606.227400@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:
>
> > Hi .NET Masters :-)
>
> > Please help me to get out of following situation ...
>
> > There is a function in one of my dlls whose signature is as follows :
> > my_function(integer X, integer Y, char* Z, HAD A, HAD P)
>
> > Here HAD is defined as follows in one of the header files as :
>
> > #define HAD LPSAFEARRAY FAR *
>
> > The above dll was written in VC++ 6.0 . I use to call this function
> > in my Visual Basic 6.0 application.
>
> > Recently , I upgraded my Visual Basic application and found
> > that its giving "SafeArrayTypeMismatchException"
>
> > Declaration for my Function is as follows :
>
> > Declare Function my_function Lib "tcvbadm.dll" (ByVal X As Integer,
> > ByVal Y
> > As Integer, ByVal Z As String, A() As String, A() As Integer) As
> > Integer
>
> > And the way I am calling in my VB application is as follows :
>
> > Dim li_count as Integer
> > ReDim la_leaf(li_count) As String
> > ReDim la_access(li_count) As Integer
>
> > retcode = my_function(X, Y, Z, A(), B()) ' HERE I AM GHETTING THE
> > EXCEPTION
> > WHERE AS IT WAS WORKING WELL PREVIOUSLY
>
> > 'I fetch li_count through a different fi=unction call which returns an
> > integer value.
>
> > Please let me know if any further info is reqd regarding this. Any
> > help
> > would be highly apprecaited ,
> > Thanks a lot in advance.
>
> > Thanks & Regards
>
> > Sudhansu Tiwari
Hi Philips,
Thanks a lot for the suggestion but my problem is I am unable to read
data in my
visual basic 2005 program . I am using passing an empty array to the C+
+ function
but its not getting filled . It was happening properly in my Visual
Basic 6.0 program.
Might be I am unable to use the array to read data from a SAFEARRAY .
Could
you kindly show me some way please.
Thanks & Regards,
Sudhansu Tiwari
.
- References:
- Prev by Date: Re: Options in making controls look 'nicer'
- Next by Date: How to put bold items in a ListBox ???
- Previous by thread: Re: "SafeArrayTypeMismatchException" - .NET MASTERS PLEASE HELP
- Next by thread: Question on inserting a control on to a form
- Index(es):
Relevant Pages
|