Пример #1
0
 public IntPtr initPathEx(string dllpath)
 {
     if (DllLib == IntPtr.Zero)
     {
         DllLib = Loaddll.LoadLibraryEx(dllpath, DllLib, LOAD_WITH_ALTERED_SEARCH_PATH);
     }
     return(DllLib);
 }
Пример #2
0
 public IntPtr initPath(string dllpath)
 {
     if (DllLib == IntPtr.Zero)
     {
         DllLib = Loaddll.LoadLibrary(dllpath);
     }
     return(DllLib);
 }
Пример #3
0
        /// <summary>
        /// 获取DLL中一个方法的委托
        /// </summary>
        /// <param name="methodname"></param>
        /// <param name="methodtype"></param>
        /// <returns></returns>
        public Delegate InvokeMethod(string methodname, Type methodtype)
        {
            IntPtr MethodPtr = Loaddll.GetProcAddress(DllLib, methodname);

            return((Delegate)Marshal.GetDelegateForFunctionPointer(MethodPtr, methodtype));
        }
Пример #4
0
 public void freeLoadDll()
 {
     Loaddll.FreeLibrary(DllLib);//释放名柄
     DllLib = IntPtr.Zero;
 }
Пример #5
0
 public LoadDllapi(string dllpath)
 {
     DllLib = Loaddll.LoadLibrary(dllpath);
 }