|

June 25th, 2009, 02:35 AM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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....
|