Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Microsoft.Windows.CsWin32 package #16

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.162">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ExternalApp(ExternalAppConfiguration configuration, ILoggerFactory logger
/// <summary>
/// Gets a value indicating whether a window handle has been set.
/// </summary>
public bool HasWindow => WindowHandle.Value != IntPtr.Zero;
public bool HasWindow => !WindowHandle.IsNull;

/// <summary>
/// Gets a value indicating whether the external application's process is running.
Expand Down Expand Up @@ -135,7 +135,7 @@ public void Dispose()
/// <returns>A string containing the window title or an empty string, if not found.</returns>
public string GetWindowTitle()
{
if (Process == null || WindowHandle.Value == IntPtr.Zero)
if (Process == null || WindowHandle.IsNull)
return string.Empty;
try
{
Expand Down Expand Up @@ -204,7 +204,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
var provider = new ProcessWindowProvider(_loggerFactory.CreateLogger<ProcessWindowProvider>());
window = provider
.GetProcessWindows()
.First(w => w.WindowHandle.Value.ToInt32() == queryWindowEventArgs.WindowHandle);
.First(w => w.WindowHandle == (IntPtr)queryWindowEventArgs.WindowHandle);
}

if (window == null)
Expand Down Expand Up @@ -416,7 +416,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
var tryCountMatch = 0;
var titleMatches = 0;

var currentWindowHandle = process != null ? new HWND(process.MainWindowHandle) : default;
var currentWindowHandle = process != null ? new HWND(process.MainWindowHandle) : HWND.Null;

do
{
Expand All @@ -433,7 +433,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
continue;

// we are still on the same window
if (titleMatchSkip > 0 && currentWindowHandle == window.WindowHandle.Value)
if (titleMatchSkip > 0 && currentWindowHandle == window.WindowHandle)
continue;

// if window title matches should be skipped
Expand Down