.netPlus / Samples / .NET

 

Dynamic PInvoke method calls

VBBubble screenshot

 

Filename: dynpinvoke.zip
Last update: 03/21/02
Size: 9 kb

 

Overview
One of the coolest things in the .NET framework has to be Reflection. System.Reflection.Emit gives you the ability to build and execute code at runtime. This sample includes a class, DllRegServer, that uses Reflection Emit to create another class with two public PInvoke methods, DllRegisterServer and DllUnregisterServer, used to register/unregister a COM DLL. The path to the DLL implementing the methods has to be set at runtime.

The DllRegServer class is then used to create a utility called Regsvr.exe, similar to the Regsvr32.exe app included with Windows. VB.NET and C# source code is included.

 

 

©2000-2024, .netPlus