Home All Groups Group Topic Archive Search About

Cal Dll was written by VC++ in VB

Author
27 May 2006 4:56 AM
Zicovn
Hi, I want to call a function int* TestCall(int ref1,int
&ref2,int n) in <MyDll.dll> file.That was written in VC++6.0. How can i
call this function in VB.
Please help me!
       Thanks!

Author
27 May 2006 4:49 PM
IdleBrain
Hai,
Add a reference to the DLL file by Right Clicking the project name in
the solution explorer. Once the reference is set, you should be able to
call the function TestCall..You might have to even register the DLL
file using RegSvr32.exe from .NET command prompt..

Hope it helps.
Author
27 May 2006 4:54 PM
Peter
Only if its a NON MFC C++ DLL & normally wouldn't need to register it


Show quoteHide quote
"IdleBrain" <indianmostwan***@yahoo.com> wrote in message
news:1148748578.558403.322780@j55g2000cwa.googlegroups.com...
> Hai,
> Add a reference to the DLL file by Right Clicking the project name in
> the solution explorer. Once the reference is set, you should be able to
> call the function TestCall..You might have to even register the DLL
> file using RegSvr32.exe from .NET command prompt..
>
> Hope it helps.
>
Author
27 May 2006 4:51 PM
Peter
Here's a good example of doing exactly what you want:

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=06613CC5-2134-404C-A4E2-CA46EF086C12


Show quoteHide quote
"Zicovn" <nguyenlinh***@gmail.com> wrote in message
news:1148705776.594736.268440@38g2000cwa.googlegroups.com...
>         Hi, I want to call a function int* TestCall(int ref1,int
> &ref2,int n) in <MyDll.dll> file.That was written in VC++6.0. How can i
> call this function in VB.
> Please help me!
>        Thanks!
>
Author
29 May 2006 7:29 AM
Zicovn
Hi ,Peter
  My proplem is not how to call Dll function in VB, my strong problem
is how to declare pointer in VB6 that is returned fron function.
  Please help me,thanks
Author
29 May 2006 8:18 PM
gmou
Unfortunately, there are several choices how this could be translated:
1) if a single pointer is returned, you could return an 'IntPtr'
2) if the pointer points to multiple integers, declare the function as
returning 'integer array'.
Can you show us how it's used in existing C++ code?
Good luck!
george
http://code2code.net - C++ to C# and VB.Net translation engine

Show quoteHide quote
"Zicovn" <nguyenlinh***@gmail.com> wrote in message
news:1148887764.371847.300510@j33g2000cwa.googlegroups.com...
>   Hi ,Peter
>  My proplem is not how to call Dll function in VB, my strong problem
> is how to declare pointer in VB6 that is returned fron function.
>  Please help me,thanks
>
Author
30 May 2006 2:22 AM
Zicovn
Hi Gmou,
      My pointer i said below points to the first element of interger
array.In "MyDll.dll" file have a function declared that int*
TestCall(int ref1,int ref2,int & n). Variable 'n' is the size of array
and function returned pointer that point to the first element in that
array.Can you tell me how to decalre function in VB6 that reference
from this C++  Dll function.I have to declare this function in VB6 to
use this Dll file.Please help me,thanks you so muck !