Beispiel #1
0
        public static void Uninit()
        {
            IntPtr pFunc2 = GetProcAddress(hMod, "ShutdownWinIo");

            if (pFunc2 != IntPtr.Zero)
            {
                ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc2, typeof(ShutdownWinIoType));

                ShutdownWinIo();
                FreeLibrary(hMod);
            }
        }
        /// <summary>
        /// 卸載WinIO
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public static bool ShutdownDriver()
        {
            IntPtr pFunc = GetProcAddress(hMod, "ShutdownWinIo");

            if (pFunc != IntPtr.Zero)
            {
                ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(ShutdownWinIoType));
                ShutdownWinIo();
                FreeLibrary(hMod);
            }
            return(true);
        }
Beispiel #3
0
        private void btnQuit_Click(object sender, EventArgs e)
        {
            IntPtr pFunc = GetProcAddress(hMod, "ShutdownWinIo");

            if (pFunc != IntPtr.Zero)
            {
                ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(ShutdownWinIoType));

                ShutdownWinIo();
                FreeLibrary(hMod);
            }

            this.Close();
        }
Beispiel #4
0
        public void Close()
        {
            if (hMod != IntPtr.Zero)
            {
                IntPtr pFunc = GetProcAddress(hMod, "ShutdownWinIo");
                if (pFunc != IntPtr.Zero)
                {
                    this.GetPortVal = null;
                    this.SetPortVal = null;

                    ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(ShutdownWinIoType));
                    ShutdownWinIo();

                    FreeLibrary(hMod);
                    hMod = IntPtr.Zero;
                }
            }
        }