Accessing "Native" DLL from a .NET App
-
Let's say that I develop the innerworkings of a program in a Win32 DLL (in Native C++) and I want the GUI for the application to take advantage of .NET. How would I work the connection between the two without resorting to turning the native C++ to Managed C++? :confused: In other words, I would like to have the .NET application to be able to access and make use of the Win32 DLL. Happy Programming and may God bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp N-Tech Productions http://www.n-tp.com/
-
Let's say that I develop the innerworkings of a program in a Win32 DLL (in Native C++) and I want the GUI for the application to take advantage of .NET. How would I work the connection between the two without resorting to turning the native C++ to Managed C++? :confused: In other words, I would like to have the .NET application to be able to access and make use of the Win32 DLL. Happy Programming and may God bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp N-Tech Productions http://www.n-tp.com/
First thing:
using System.Runtime.InteropServices;
along with your other using statements in the beginning of the c file.. then create a class:public class DllWrap { [DllImport(string DllName) public static extern int/bool/string/... FunctionName(function calls); }
when you have to call the function from the code:DllWrap.FunctionName(calls needed);
Hope it works for you... Regards.. -
First thing:
using System.Runtime.InteropServices;
along with your other using statements in the beginning of the c file.. then create a class:public class DllWrap { [DllImport(string DllName) public static extern int/bool/string/... FunctionName(function calls); }
when you have to call the function from the code:DllWrap.FunctionName(calls needed);
Hope it works for you... Regards..Thanks for your response! :-D Happy Programming and may God bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp N-Tech Productions http://www.n-tp.com/