Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 25th, 2009, 02:35 AM
Registered User
 
Join Date: Jun 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default VC++ Dll calling from VB 6.0

Dear Friends,

I have a Dll written in VC++ and now I want to access that dll from my Vb application.

I have so many calls in that vc++ dll.

Example :

typedefstruct tripWireSettings_Tag{
bool bTripWireAnalytic;
U8 u8NoOfTripWires;
StructU32Point stStartPoint[MAX_NUM_TRIP_WIRES];
StructU32Point stEndPoint[MAX_NUM_TRIP_WIRES];
EnumDirection eTripwireDirection[MAX_NUM_TRIP_WIRES];
} tripWireSettings;

this structure internally calls one more structure "StructU32Point "

typedefstruct StructU32Point_Tag
{
U32 u32X;
U32 u32Y;
}StructU32Point;

Now I am trying to access this strcuture from my Vb application, as following,

I declared these structures in module as

Public Type tripWireSettings_Tag
bTripWireAnalytic As Boolean
u8NoOfTripWires As Byte
stStartPoint(MAX_NUM_TRIP_WIRES) As StructU32Point_Tag
stEndPoint(MAX_NUM_TRIP_WIRES) As StructU32Point_Tag
eTripwireDirection(MAX_NUM_TRIP_WIRES) As EnumDirection_Tag
End Type

and

Public Type StructU32Point_Tag
u32X As Long
u32Y As Long
End Type

Public Declare Function va_set_tripwire_info Lib "Intrulib.dll" (ByVal lCamHandle As Long, Byref g_sParam As tripWireSettings_Tag) As Long

In VB form,

I will Call a Dll function as below,

Dim tSettings As tripWireSettings_Tag
tSettings.bTripWireAnalytic = True
tSettings.u8NoOfTripWires = 1
tSettings.stStartPoint(0).u32X = 50
tSettings.stStartPoint(0).u32Y = 40
tSettings.stEndPoint(0).u32X = 299
tSettings.stEndPoint(0).u32Y = 199
tSettings.eTripwireDirection(0) = Right

lRet = va_set_tripwire_info(lCamHandle, tSettings)

After this when i run my Vb application, I'm not able to get proper values from VC++ Dll, its returning Junk values,

Really I am serachng for answers from so many days. Please help me "How to pass complex structres as parameters to a VC++ dll from Vb application."

Thanks in advance....







Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a VB program or DLL from Access JOK Access VBA 1 October 12th, 2007 12:59 AM
How to access functions of Dll created in VC in VB seeekvb BOOK: Beginning ASP.NET 1.0 4 January 15th, 2007 06:58 PM
Face problem to use DLL created using VB in VC++ chirag_chauhan Beginning VB 6 1 January 17th, 2005 10:56 PM
Calling a .Dll of Vb.NET enggalok C++ Programming 0 March 1st, 2004 06:51 PM
Help me wirte dll in VC for use VB tranhung Visual C++ 0 February 12th, 2004 11:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.