atkinsHOU
asked on
Multiple classes in ActiveX DLL
Hi, all,
I need to create a dll that will handle several different cases. I want to create several classes in the dll that each will handle individual case, and all these cases have data and functions in common.
So I want to create a main class that contains all the data and functions in common.
For example I have the followings:
1: Main class named MyMainClass.cls with function GeneratePaper()
2:MyCaseAClass.cls with function insertCaseAContents();
3:MyCaseBClass.cls with function insertCaseBContents().
My question are :
1: If I want to call insertCaseAContents() in GeneratePaper in main class, I should do like:
Dim caseAObj as MyCaseAClass
set caseAObj = new MyCaseAClass
caseAObj.insertCaseAConten ts()
is it right?
2: If I create a DLL file, then create a package, then use it in ASP application like the following:
<object ID="DLLObj" viewastext style="display:none" CLASSID="CLSID:**** codebase="MyPackage.CAB#ve rsion=2,0, 0,0"></obj ect>
Does all these functions (suppose they are all public) are visible to DLLObj, do not matter which classes they are in? so I can call like:
DLLObj.GeneratePaper
DLLObj.insertCaseAContents
DLLObj.insertCaseBContents ??
Can these classes have the same name functions? if yes, how the DLLObj can tell the difference?
Thanks!
LT
I need to create a dll that will handle several different cases. I want to create several classes in the dll that each will handle individual case, and all these cases have data and functions in common.
So I want to create a main class that contains all the data and functions in common.
For example I have the followings:
1: Main class named MyMainClass.cls with function GeneratePaper()
2:MyCaseAClass.cls with function insertCaseAContents();
3:MyCaseBClass.cls with function insertCaseBContents().
My question are :
1: If I want to call insertCaseAContents() in GeneratePaper in main class, I should do like:
Dim caseAObj as MyCaseAClass
set caseAObj = new MyCaseAClass
caseAObj.insertCaseAConten
is it right?
2: If I create a DLL file, then create a package, then use it in ASP application like the following:
<object ID="DLLObj" viewastext style="display:none" CLASSID="CLSID:**** codebase="MyPackage.CAB#ve
Does all these functions (suppose they are all public) are visible to DLLObj, do not matter which classes they are in? so I can call like:
DLLObj.GeneratePaper
DLLObj.insertCaseAContents
DLLObj.insertCaseBContents
Can these classes have the same name functions? if yes, how the DLLObj can tell the difference?
Thanks!
LT
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In that case you cannot duplicate names, you can have an object that performs like this,:
If(x)
myObj.functionA()
else
myObj.functionB()
According to this article you can have multiple classes in the same DLL but I have not tried it, i don't see why it won't work though:
http://msdn2.microsoft.com/en-us/library/ms973807.aspx
If(x)
myObj.functionA()
else
myObj.functionB()
According to this article you can have multiple classes in the same DLL but I have not tried it, i don't see why it won't work though:
http://msdn2.microsoft.com/en-us/library/ms973807.aspx
ASKER
My question is that if I use the DLL in ASP program, Can the DLL object can access all the public function, doesn't matter which classes the function is belonged to????
For example:
<object ID="DLLObj" viewastext ..............>
DLLObj.function1InClass1()
DLLObj.function1inClass2()
Can I?
For example:
<object ID="DLLObj" viewastext ..............>
DLLObj.function1InClass1()
DLLObj.function1inClass2()
Can I?
yes
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
ASKER
I don't want to have several DLL, I want only one DLL with multiple classes, and create a .cab file based on this DLL, then used in ASP.
In ASP file, I will create a OBJECT of the DLL, then call the functions. Can I call all the functions, doesn't matter which class the function is belong to?