FelicaLib.BindDLL.GetProcAddress C# (CSharp) Method

GetProcAddress() private method

private GetProcAddress ( IntPtr hModule, [ lpProcName ) : IntPtr
hModule System.IntPtr
lpProcName [
return System.IntPtr
        private static extern IntPtr GetProcAddress(IntPtr hModule, [MarshalAs(UnmanagedType.LPStr)]  string lpProcName);

Usage Example

Beispiel #1
0
        /// <summary>
        /// 指定名のアンマネージ関数ポインタをデリゲートに変換
        /// </summary>
        /// <param name="szProcName">アンマネージ関数名</param>
        /// <param name="typDelegate">変換するデリゲートのType</param>
        /// <returns>変換したデリゲート</returns>
        public Delegate GetDelegate(string szProcName, Type typDelegate)
        {
            IntPtr pProc = BindDLL.GetProcAddress(_pModule, szProcName);

            if (pProc != IntPtr.Zero)
            {
                Delegate oDG = Marshal.GetDelegateForFunctionPointer(pProc, typDelegate);
                return(oDG);
            }
            int nResult = Marshal.GetHRForLastWin32Error();

            throw Marshal.GetExceptionForHR(nResult);
        }