/// <summary> /// Binds the class instance methods to the dll functions. /// </summary> /// <param name="hDll">A dll to bind to.</param> private void BindToDll(IntPtr hDll) { IntPtr pProcPtr = GetProcAddress(hDll, "Initialize"); _initialize = (InitializeDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(InitializeDelegate)); //pProcPtr = GetProcAddress(hDll, "Open"); //_open = // (OpenDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(OpenDelegate)); pProcPtr = GetProcAddress(hDll, "StartPlay"); _startPlayDelegate = (StartPlayDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(StartPlayDelegate)); pProcPtr = GetProcAddress(hDll, "GetCurrentFrame"); _getCurrentFrame = (GetCurrentFrameDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(GetCurrentFrameDelegate)); pProcPtr = GetProcAddress(hDll, "GetFrameSize"); _getFrameSize = (GetFrameSizeDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(GetFrameSizeDelegate)); pProcPtr = GetProcAddress(hDll, "Stop"); _stop = (StopDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(StopDelegate)); pProcPtr = GetProcAddress(hDll, "Uninitialize"); _uninitialize = (UninitializeDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(UninitializeDelegate)); }
/// <summary> /// Binds the class instance methods to the dll functions. /// </summary> /// <param name="hDll">A dll to bind to.</param> private void BindToDll(IntPtr hDll) { IntPtr pProcPtr = GetProcAddress(hDll, "Initialize"); _initialize = (InitializeDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(InitializeDelegate)); pProcPtr = GetProcAddress(hDll, "StartPlay"); _startPlayDelegate = (StartPlayDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(StartPlayDelegate)); pProcPtr = GetProcAddress(hDll, "StartPlayPiP"); _startPlayPiPDelegate = (StartPlayPiPDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(StartPlayPiPDelegate)); pProcPtr = GetProcAddress(hDll, "GetCurrentFrame"); _getCurrentFrame = (GetCurrentFrameDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(GetCurrentFrameDelegate)); pProcPtr = GetProcAddress(hDll, "GetFrameSize"); _getFrameSize = (GetFrameSizeDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(GetFrameSizeDelegate)); pProcPtr = GetProcAddress(hDll, "SetupPiP"); _setupPiP = (SetupPiPDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(SetupPiPDelegate)); pProcPtr = GetProcAddress(hDll, "SetupZoom"); _setupZoom = (SetupZoomDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(SetupZoomDelegate)); pProcPtr = GetProcAddress(hDll, "SetupCross"); _setupCross = (SetupCrossDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(SetupCrossDelegate)); pProcPtr = GetProcAddress(hDll, "Stop"); _stop = (StopDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(StopDelegate)); pProcPtr = GetProcAddress(hDll, "Uninitialize"); _uninitialize = (UninitializeDelegate)Marshal.GetDelegateForFunctionPointer(pProcPtr, typeof(UninitializeDelegate)); }