Using VB dll in C++
-
Hi! I'm trying to use some functions in a dll written in VB 6.0. I have sample code for using the dll from VB (se below) but I don't really know how to go about using it from my C++ app. Any help would be very much appreciated! VB code exemple:
'Declaration: Private MyVBObject As New TheVBObject.cTheVBObject 'Startup: If Not MyVBObject.Init("Arg1","Arg2","Arg3") Then MsgBox "Init Fail!", vbCritical & vbOKOnly, "Init" End End If 'Use: MyVBObject.Var1 = " " If MyVBObject.DoStuff("Arg1","Arg2") Then If MyVBObject.Error > 3 _ And (MyVBObject.Error <> 4) Then MsgBox MyVBObject.ErrTxt frmObject.MousePointer = vbNormal Exit Sub End If Else MsgBox "Error using it", vbCritical & vbOKOnly, "Using" End If 'Read the properties... 'Dim MyProp = MyVBObject.Prop1 '... or something like that...
-
Hi! I'm trying to use some functions in a dll written in VB 6.0. I have sample code for using the dll from VB (se below) but I don't really know how to go about using it from my C++ app. Any help would be very much appreciated! VB code exemple:
'Declaration: Private MyVBObject As New TheVBObject.cTheVBObject 'Startup: If Not MyVBObject.Init("Arg1","Arg2","Arg3") Then MsgBox "Init Fail!", vbCritical & vbOKOnly, "Init" End End If 'Use: MyVBObject.Var1 = " " If MyVBObject.DoStuff("Arg1","Arg2") Then If MyVBObject.Error > 3 _ And (MyVBObject.Error <> 4) Then MsgBox MyVBObject.ErrTxt frmObject.MousePointer = vbNormal Exit Sub End If Else MsgBox "Error using it", vbCritical & vbOKOnly, "Using" End If 'Read the properties... 'Dim MyProp = MyVBObject.Prop1 '... or something like that...
Check out MSDN Article #ID Q194873 example 2 for an easy way. Or look at http://www.codeproject.com/com/vb\_from\_vc.asp for some other helpful hints. It requires you to understand COM under C++ but the CP link is a beginners article that is easy to understand.
-
Check out MSDN Article #ID Q194873 example 2 for an easy way. Or look at http://www.codeproject.com/com/vb\_from\_vc.asp for some other helpful hints. It requires you to understand COM under C++ but the CP link is a beginners article that is easy to understand.