public static IntPtr LoadLibrary(string filePath) { IntPtr handle = NativeWin32.LoadLibraryNative(filePath); if (handle == IntPtr.Zero) { throw new Win32Exception(Marshal.GetLastWin32Error()); } return(handle); }
public NativeRazerApi() { if (Environment.Is64BitProcess) { _chromaSdkDll = NativeWin32.LoadLibrary("RzChromaSDK64.dll"); } else { _chromaSdkDll = NativeWin32.LoadLibrary("RzChromaSDK.dll"); } this.LoadNativeFunctions(); this.LoadDelegateFunctions(); this.Init(); }
private void LoadNativeFunctions() { _functionPointerInit = NativeWin32.GetProcAddress(this._chromaSdkDll, "Init"); _functionPointerUnInit = NativeWin32.GetProcAddress(this._chromaSdkDll, "UnInit"); _functionPointerRegisterEventNotification = NativeWin32.GetProcAddress(this._chromaSdkDll, "RegisterEventNotification"); _functionPointerUnRegisterEventNotification = NativeWin32.GetProcAddress(this._chromaSdkDll, "UnregisterEventNotification"); _functionPointerQueryDevice = NativeWin32.GetProcAddress(this._chromaSdkDll, "QueryDevice"); _functionPointerSetEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "SetEffect"); _functionPointerDeleteEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "DeleteEffect"); _functionPointerCreateEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "CreateEffect"); _functionPointerCreateKeyboardEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "CreateKeyboardEffect"); _functionPointerCreateMouseEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "CreateMouseEffect"); _functionPointerCreateMousepadEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "CreateMousepadEffect"); _functionPointerCreateKeypadEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "CreateKeypadEffect"); _functionPointerCreateHeadsetEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "CreateHeadsetEffect"); _functionPointerCreateChromaLinkEffect = NativeWin32.GetProcAddress(this._chromaSdkDll, "CreateChromaLinkEffect"); }