cossy74
asked on
DLL Classes and running functions
Hi ,
Currently is use the Assembly.LoadFile function to load the DLL. This works :)
Then i use the SampleAssembly.GetTypes in a foreach loop to find the class i want. This works :)
Then i use the following to load the class:
object oClass = Activator.CreateInstance(o ClassType) ;
My question is, Without knowing the class structure of the DLL Class, how can i call a function inside that class?
Currently is use the Assembly.LoadFile function to load the DLL. This works :)
Then i use the SampleAssembly.GetTypes in a foreach loop to find the class i want. This works :)
Then i use the following to load the class:
object oClass = Activator.CreateInstance(o
My question is, Without knowing the class structure of the DLL Class, how can i call a function inside that class?
If its a COM dll and you know its class reference you can call for example:
[DllImport("GDI32.DLL", EntryPoint = "CreateRectRgn")]
private static extern int CreateRectRgn(int x1, int y1, int x2, int y2);
If its a .Net assembly just put in your using clause the name of the namespace registered in the assembly.
Regards,
Mishu
[DllImport("GDI32.DLL", EntryPoint = "CreateRectRgn")]
private static extern int CreateRectRgn(int x1, int y1, int x2, int y2);
If its a .Net assembly just put in your using clause the name of the namespace registered in the assembly.
Regards,
Mishu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://my.execpc.com/~gopalan/dotnet/reflection.html
under the section
"Obtaining Member Information from a Class"