mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[VCM] Fix issues on certain systems (#12481)
- Don't depend on System.Windows.Forms in the Settings -> use callback instead - Fix overlay image setting saving - Use dynamic DLL loading in Interop - Load VCM only when mf.dll is available
This commit is contained in:
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
@@ -37,11 +38,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
set { Set(ref isBackEnabled, value); }
|
||||
}
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern IntPtr LoadLibrary(string dllToLoad);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern bool FreeLibrary(IntPtr hModule);
|
||||
|
||||
public bool IsVideoConferenceBuild
|
||||
{
|
||||
get
|
||||
{
|
||||
return this != null && File.Exists("modules/VideoConference/VideoConferenceModule.dll");
|
||||
var mfHandle = LoadLibrary("mf.dll");
|
||||
bool mfAvailable = mfHandle != null;
|
||||
if (mfAvailable)
|
||||
{
|
||||
FreeLibrary(mfHandle);
|
||||
}
|
||||
|
||||
return this != null && File.Exists("modules/VideoConference/VideoConferenceModule.dll") && mfAvailable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user