Results 1 to 3 of 3

Thread: Interface Classes..Missed somthing? (NOT RESOLVED)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    31

    Interface Classes..Missed somthing? (NOT RESOLVED)

    As I have understood..
    Interface classes are used inside COM components, inorder for the developer to maintain CallBack procedures, these callbacks are notifications sent between the client and the server.

    Implementing interface classes requiers that the class contains only the definition of the methods and procedures, while the acting code is in a class contained in the client application.

    And as I have understood, the most significant advantage using COM components, is the ease of update, that is, you update the server only in one place, rather than updating each client application.

    Here rises the question:
    In case of using Interface Classes, don't we loose that significant advantage?
    Last edited by Rdn; Aug 31st, 2002 at 04:23 AM.

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Your definitions seem consfused. To me ,anyway.

    COM classes are external (in a server: dll, .cls module, or .EXE)
    to the client. The client requests a connection (instance). Part of Windows, called the SCM, makes the connection for the client by mapping the COM server into client memory space. So, the COM server lives, for a while, sharing memory in the client process.

    IF the server is an EXE then the SCM sets up marshaling (sending data via proxy back & forth between the client & the server). It doesn't map the server into the process memory in this case.

    Interface definitions are: a list of pointers to functions. That's all.
    It's a VTABLE in C++. They are meant to be purely binary, to the point where the client cannot know anything about the server (and vice-versa) except what function(s) the interface provides.

    Plus, the client has to know how to call the function (parameters,datatypes, etc) in the interface. The server does not provide this information, unless there is a type library associated with the server. If you don't want somebody to use your COM server (after all, you wrote it) do not provide type library information. Your stuff is safe from pirates.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    31
    I think I have not explained my idea clearly.The follwing illustration makes it clear:

    Interface Class:
    Code:
    'Class name: IClass1
    Public Sub Method1
    End Sub
    
    Public Sub Method2
    End Sub
    
    Public Function Add (Byval sng1 As Single, Byval sng2 As Single) As Single
    End Function
    Client side class:
    Code:
    Option Explicit
    'Class name: cMathmatics
    Implements IClass1
    
    Public Sub Method1
    'Do somethign
    End Sub
    
    Public Sub Method2
    'Do something else
    End Sub
    
    Public Function Add (Byval sng1 As Single, Byval sng2 As Single) As Single
    'Add sng1 to sng2
    End Function
    Using the interface class in Form1
    Code:
    Dim x As cMathmatics
    Dim y As IClass1
    
    Private Sub Command1_Click
    Set x = New cMathmatics
    Set y = New x
    Text1.Text = y.Add(3.5,14.6)
    End Sub
    In this case, when you want to update, you have to update all client side classes. and this was my question.

Posting Permissions

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



Click Here to Expand Forum to Full Width