Multiple classes in ActiveX DLL

Posted on 2007-07-23
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
   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.insertCaseBContents ??

Can these classes have the same name functions? if yes, how the DLLObj can tell the difference?




Question by:atkinsHOU
    LVL 12

    Accepted Solution

    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.

    Author Comment

    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?
    LVL 12

    Expert Comment

    In that case you cannot duplicate names, you can have an object that performs like this,:

    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:

    Author Comment

    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 ..............>


    Can I?
    LVL 12

    Expert Comment

    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    Define alias for servlet 5 32
    Internet Explorer 11 Application Crash 6 30
    how to configure and install nginx ? 1 347
    Specific format 21 104
    Introduction HyperText Transfer Protocol ( or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
    Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
    This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now