Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Building a Modular System

Building a Modular System

Scheduled Pinned Locked Moved Visual Basic
tutorial
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheFarsider
    wrote on last edited by
    #1

    Hi I am writing a service which needs to monitor multiple programs/files etc on a system. The Service is being designed so that it will call standard methods against a range of Standardised dll's. Application1.GetLastEvent 'Where Application1 is an dll written purely to talk to Application1 Application2.GetlastEvent 'Where Application2 is another dll written purely to talk to Application2 Each dll is being written to get the relevent details from a particular application. Now I could compile the application with all the dll's and just have a setting to only make the request if the application is installed but this would mean rebuilding and and redeploying the service if we wanted to add and check application 3. Im sure this must be possible at runtime. What I want to achieve is have a runtime list of dll's for the installed applications and make the standard calls against each in turn. The Application should not need to know anything about these apart from the methods which are standard across all of the them. Thanks in advance, I dont really need a full code listing on this one just a nudge in the right direction as cant seem to find the correct terms to find anything on the WWW. :confused: James First learn how to speak ~ Then you figure out what Language to speak

    D 1 Reply Last reply
    0
    • T TheFarsider

      Hi I am writing a service which needs to monitor multiple programs/files etc on a system. The Service is being designed so that it will call standard methods against a range of Standardised dll's. Application1.GetLastEvent 'Where Application1 is an dll written purely to talk to Application1 Application2.GetlastEvent 'Where Application2 is another dll written purely to talk to Application2 Each dll is being written to get the relevent details from a particular application. Now I could compile the application with all the dll's and just have a setting to only make the request if the application is installed but this would mean rebuilding and and redeploying the service if we wanted to add and check application 3. Im sure this must be possible at runtime. What I want to achieve is have a runtime list of dll's for the installed applications and make the standard calls against each in turn. The Application should not need to know anything about these apart from the methods which are standard across all of the them. Thanks in advance, I dont really need a full code listing on this one just a nudge in the right direction as cant seem to find the correct terms to find anything on the WWW. :confused: James First learn how to speak ~ Then you figure out what Language to speak

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      TheFarsider wrote:

      The Service is being designed so that it will call standard methods against a range of Standardised dll's.

      Are these .DLL's being written so that each one is programmed to interact with a specific application?? I think you're talking about "plugin" support for your service app. Your service app would look for these plugins in a specific folder and load them one by one. Each .DLL would have to implement an interface that the service expects them to have so the service can communicate with each plugin.

      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      T 1 Reply Last reply
      0
      • D Dave Kreskowiak

        TheFarsider wrote:

        The Service is being designed so that it will call standard methods against a range of Standardised dll's.

        Are these .DLL's being written so that each one is programmed to interact with a specific application?? I think you're talking about "plugin" support for your service app. Your service app would look for these plugins in a specific folder and load them one by one. Each .DLL would have to implement an interface that the service expects them to have so the service can communicate with each plugin.

        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        T Offline
        T Offline
        TheFarsider
        wrote on last edited by
        #3

        Dave Thanks for the reply. The Plugin Method is one I did look at but I have managed to find the solution and once I got to the route of it, was really quite simple although admitadly I dont fully understand the solution myself yet. Thanks to Peter Huang and Terry for hitting a similar problem and providing me the vital clues Below is my proof of concept code '#### Application Code ### Dim ModulePath As String = ".\Modules\" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim di As New IO.DirectoryInfo(ModulePath) Dim aryFi As IO.FileInfo() = di.GetFiles("*.dll") Dim fi As IO.FileInfo For Each fi In aryFi dllName = "James" GetCopyrights(fi.FullName, dllName) Next End Sub Sub GetCopyrights(ByVal dllPath As String, ByVal dllName as String) Dim oRMS As Object = Nothing Try oRMS = Activator.CreateInstanceFrom(dllPath, dllName & ".RMS.Controller").Unwrap() Catch ex As Exception Console.WriteLine(ex.ToString()) End Try If oRMS IsNot Nothing Then Console.WriteLine (oRMS.Copyright()) End If oRMS = Nothing End Sub '### Sample DLL Code ### Namespace RMS Public Interface iController Function Copyright() As String End Interface Public Class Controller Implements iController Function Copyright() As String Implements iController.Copyright Return "James Tutton 2007" End Function End Class End Namespace The only thing id still like to do is make sure the interfaces are common for both the dll and oRMS . The Overall purpose is building a service that uses a common interface for performing common activities. Sorry for the vagueness of my explanations but I am working under some strict NDA's on the specifics of the project. --How do you quote on this site??? anyhow Are these .DLL's being written so that each one is programmed to interact with a specific application?? Yes, the idea is that we build a dll to interact with each third party application we need to intereact with but all the calls and return values are normalised across them by the dlls.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups