DLL Event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MWismet

    DLL Event

    Hello!

    I worked with vb6 and now it I'm working with VS C# 2005
    (I'm an c#- beginner)

    I have a main progamm which search for Dlls in a folder.
    I include all dlls and thats no problem: i can call the functions with
    arguments.

    Now my problem is that the dll has an event "ErrorEvent(str ing errmsg)"
    which should be raised and the mainprogramm should notify and take
    care of this message (Show Messagebox for examle).

    I tried with delegation but it didn't work.

    Can anyone help me.

    Thank you!

  • Ciaran O''Donnell

    #2
    RE: DLL Event

    Could you post some code as to what you are trying to do. Also, are you
    using visual studio or comand line compiling?

    Ciaran O'Donnell

    "MWismet" wrote:
    Hello!
    >
    I worked with vb6 and now it I'm working with VS C# 2005
    (I'm an c#- beginner)
    >
    I have a main progamm which search for Dlls in a folder.
    I include all dlls and thats no problem: i can call the functions with
    arguments.
    >
    Now my problem is that the dll has an event "ErrorEvent(str ing errmsg)"
    which should be raised and the mainprogramm should notify and take
    care of this message (Show Messagebox for examle).
    >
    I tried with delegation but it didn't work.
    >
    Can anyone help me.
    >
    Thank you!
    >
    >

    Comment

    • MWismet

      #3
      Re: DLL Event

      Hello Ciaran,

      thank you for answering!

      the following code is okay:
      *************** *************** *************** *
      AssemblyName name = new AssemblyName();

      name.CodeBase = str_DLL_FILE;
      Assembly assembly = AppDomain.Curre ntDomain.Load(n ame);

      object remoteObject ;
      remoteObject= assembly.Create Instance(str_NA ME_SPACE, false, myFlags,
      null, args, null,null);
      Type remoteType = assembly.GetTyp e(str_NAME_SPAC E);

      //call the methode Get_Dll_Version s_Number
      //returns a string with versionnumber of dll
      MethodInfo methode = remoteType.GetM ethod("Get_Dll_ Versions_Number ");
      object result = methode.Invoke( remoteObject, null);
      string v_num = result.ToString ();
      *************** *************** *************** *

      the dll has an event with the name "Dll_Error_Hand ler" with a string
      containing the errorstring.

      how can i get this event??

      in the moment i try to solve the problem with an
      abstract class, because the interface is known
      and dll and mainprg are including this class.

      I'm using visual studio 2005

      thank you

      Michael



      Ciaran O''Donnell schrieb:
      Could you post some code as to what you are trying to do. Also, are you
      using visual studio or comand line compiling?
      >
      Ciaran O'Donnell
      >
      "MWismet" wrote:
      >
      Hello!

      I worked with vb6 and now it I'm working with VS C# 2005
      (I'm an c#- beginner)

      I have a main progamm which search for Dlls in a folder.
      I include all dlls and thats no problem: i can call the functions with
      arguments.

      Now my problem is that the dll has an event "ErrorEvent(str ing errmsg)"
      which should be raised and the mainprogramm should notify and take
      care of this message (Show Messagebox for examle).

      I tried with delegation but it didn't work.

      Can anyone help me.

      Thank you!

      Comment

      • MWismet

        #4
        Re: DLL Event

        Hello Ciaran,

        thank you!

        i managed it with the abstract class!

        now it works and it's very easy to implement!

        By Michael

        Comment

        Working...