Simple: Access to a COM VB module

Results 1 to 5 of 5

Thread: Simple: Access to a COM VB module

  1. #1
    SPG Guest

    Default Simple: Access to a COM VB module

    The topic is advanced, the answer is really simple (true/false):<BR><BR>Can I access a VB Module (*.bas -- not a class) in a COM object either directly or through a class that doesn&#039;t explicity provide wrappers for it from ASP? Or would I have to write a class to wrap the module for ASP?<BR><BR>Good thing to know _before_ refactoring to test...<BR>Thanks!<BR>SPG

  2. #2
    Steve Cimino Guest

    Default RE: Simple: Access to a COM VB module

    There aren&#039;t any "interfaces" for you to allow access to it, nor could you in fact instatiate it. I believe that VB allows you access to it in your apps because it does in fact write a wrapper.<BR><BR>Even though your variable inside that module may be public, I don&#039;t think you have access to it...<BR><BR>One side note: This totally defeats the purpose of OOP... can I ask why you&#039;re attempting this?

  3. #3
    SPG Guest

    Default Clarification & Answer

    Clarification: I&#039;m not going after variables [eGad, no! *shudder*], I&#039;m going after simple (commonplace contextless, stateless) utility functions like "isBlank" and "hasNonAlpha" that I don&#039;t want to have to &#060;!--#include --&#062; at the VBScript level and keep another (different) VB copy of in the COM object. <BR><BR>Besides, VB is explicitly !Not! OOP. If it were, I could just inherit the functionality down my classes and not have to ask silly VB compiler-theory questions about how *.bas files are handled.<BR><BR>Annoyingly, however, MTS doesn&#039;t recognize the methods in the module (I&#039;ll try storing them in madness next) which indicates to me that "No, you can&#039;t get to them through classes that can use them." If anybody knows how to override this (without destabilizing the system), please share.<BR><BR>SPG (doesn&#039;t even want to know why you thought he might be using global public variables in a module...)

  4. #4
    Steve Cimino Guest

    Default RE: Clarification & Answer

    Heh, okay. I meant variable/function/sub that was public, but didn&#039;t really feel like typing it all out.<BR><BR>As far as OOP, I meant more of the design rather than the specific language used to implement it.<BR><BR>Have you used the implements keyword? I personally find it a POS keyword (and more of a hassle than anything else) but it may fit well into your solution. On the side note, why does it have to be a BAS? Why not make a class that contains all these public functions(err... variables ;))<BR><BR>Seriously, it&#039;s a hack of a solution, but it is an option.

  5. #5
    SPG Guest

    Default Implements & Class

    Yes, "implements" is very very evil. I tried using it once, found that it increased the amount of code I had to write (as opposed to recycling a class file), so I stopped using it. <BR><BR>I used to put utility functions into a specific class and then reference that class as appropriate, but, in addition to being dubious-if-not-bad OO ["inherits Amorphous_Blob?"], I quickly grew annoyed by having to create & destroy references to the utility class all over the place.<BR><BR>Oh well. If my client cared about performance, they wouldn&#039;t be using old NT4/IIS4 boxes. If they cared about elegant code, they wouldn&#039;t have me using VB & VBScript.<BR><BR>Thanks for the input!<BR>SPG

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts