|
-
Sep 30th, 2000, 04:10 PM
#1
Thread Starter
New Member
Hello,
I created an OCX file in C++. It contains a couple of functions each of which have arguments and return values.
After registering the OCX and putting it on the ToolBox in VB6....what must I do to be able to use the functions?
I have tried the following:
Dim Var1 As MyFunctLib.Myfunct
where Var1 is a new label
MyFunctLib is the name of the ocx library
Myfunct is the name of the OCX "Toolbox object"
Then I added the following line...
Var2 = Var1.GetData(1)
where Var2 is a new variable
GetData(1) is a function in the Myfunct Object
In this example, the C function I am accessing looks like this:
short GetData(short VarName)
{
if(VarName == 1)
return(1)
else
return(0)
}
Question: Is there something I need to do to "Reference" the object in the VB project before using it?
I cannot find any examples showing the implementation of an OCX function with parameters in VB. Any help is appreciated
Thanks Much!
Bob Bouthillier
-
Sep 30th, 2000, 04:45 PM
#2
Hyperactive Member
I'm not sure, but isn't an OCX an ActiveX control? I think what you need is a DLL.
-
Sep 30th, 2000, 05:06 PM
#3
Well, yes.
If you've created your function inside the Usercontrol and declared it Public, then you can use:
var = userctlname.FunctionName(Params)
AFTER you've added the usercontrol to your form.
OR, you can find yourcontrolname in the REFERENCES, or BROWSE for it.
I agree with dsy5, using a AXDLL is MUCH easier.
-
Oct 1st, 2000, 11:51 AM
#4
Thread Starter
New Member
Thanks for the advice to pursue it as a AXDLL.
I've now created a dll with automation and put the same function into it. However, since I'm a C/C++ programmer, and not a VB programmer, I don't know how to properly declare the function and use it in VB6.
Can anyone help with this?
Thanks.
Bob
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|