DLL Event

  • Thread starter Thread starter MWismet
  • Start date Start date
M

MWismet

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(string 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!
 
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
 
Hello Ciaran,

thank you for answering!

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

name.CodeBase = str_DLL_FILE;
Assembly assembly = AppDomain.CurrentDomain.Load(name);

object remoteObject ;
remoteObject= assembly.CreateInstance(str_NAME_SPACE, false, myFlags,
null, args, null,null);
Type remoteType = assembly.GetType(str_NAME_SPACE);

//call the methode Get_Dll_Versions_Number
//returns a string with versionnumber of dll
MethodInfo methode = remoteType.GetMethod("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_Handler" 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
 
Hello Ciaran,

thank you!

i managed it with the abstract class!

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

By Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top