实现winform 代码导入dll

代码如下:

        [DllImport("kernel32.dll", EntryPoint = "LoadLibrary")]
        public static extern IntPtr LoadLibrary(string sLibName);

        [DllImport("kernel32.dll", EntryPoint = "FreeLibrary")]
        public static extern int FreeLibrary(string sLibName);

IntPtr hDll = LoadLibrary("××.DLL");
            if (hDll == IntPtr.Zero)
            {
                MessageBox.Show("Can't load library!");
                return false;
            }
 

你可能感兴趣的:(WinForm)