[CDPX] Fix build: move dll imports to NativeMethods (#12544)
This commit is contained in:
parent
04636339ce
commit
5a97db8992
|
@ -2,6 +2,7 @@
|
||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||||
|
@ -20,6 +21,12 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern bool AllowSetForegroundWindow(int dwProcessId);
|
public static extern bool AllowSetForegroundWindow(int dwProcessId);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
||||||
|
public static extern IntPtr LoadLibrary(string dllToLoad);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
||||||
|
public static extern bool FreeLibrary(IntPtr hModule);
|
||||||
#pragma warning restore CA1401 // P/Invokes should not be visible
|
#pragma warning restore CA1401 // P/Invokes should not be visible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,21 +38,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||||
set { Set(ref isBackEnabled, value); }
|
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
|
public bool IsVideoConferenceBuild
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var mfHandle = LoadLibrary("mf.dll");
|
var mfHandle = NativeMethods.LoadLibrary("mf.dll");
|
||||||
bool mfAvailable = mfHandle != null;
|
bool mfAvailable = mfHandle != null;
|
||||||
if (mfAvailable)
|
if (mfAvailable)
|
||||||
{
|
{
|
||||||
FreeLibrary(mfHandle);
|
NativeMethods.FreeLibrary(mfHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this != null && File.Exists("modules/VideoConference/VideoConferenceModule.dll") && mfAvailable;
|
return this != null && File.Exists("modules/VideoConference/VideoConferenceModule.dll") && mfAvailable;
|
||||||
|
|
Loading…
Reference in a new issue