?
Solved

Multiple classes in ActiveX DLL

Posted on 2007-07-23
7
Medium Priority
?
244 Views
Last Modified: 2013-11-18
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.insertCaseAContents()
   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#version=2,0,0,0"></object>

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


      



0
Comment
Question by:atkinsHOU
  • 3
  • 2
6 Comments
 
LVL 12

Accepted Solution

by:
lunadl earned 2000 total points
ID: 19549567
Yes they you need to compile the DLL and put them in the bin directory of your application and register them on your page. You can have functions with the same name in each DLL because they are differentiated by the object/class name.
0
 

Author Comment

by:atkinsHOU
ID: 19550051
Thanks for you reply.
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?
0
 
LVL 12

Expert Comment

by:lunadl
ID: 19550460
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
0
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 

Author Comment

by:atkinsHOU
ID: 19550927
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?
0
 
LVL 12

Expert Comment

by:lunadl
ID: 19550948
yes
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20633768
Forced accept.

Computer101
EE Admin
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question