Skip to content

Commit

Permalink
Correctly use ref parameters when flashing taskbar icon (#1236)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN authored Oct 28, 2024
1 parent 594c990 commit e272112
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions TwitchDownloaderWPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private async void FlashTaskbarIconIfNotForeground(TimeSpan flashDuration)
FlashCount = uint.MaxValue,
Timeout = 0
};
_ = NativeFunctions.FlashWindowEx(flashWInfo);
_ = NativeFunctions.FlashWindowEx(ref flashWInfo);

await Task.Delay(flashDuration);

Expand All @@ -165,7 +165,7 @@ private async void FlashTaskbarIconIfNotForeground(TimeSpan flashDuration)
FlashCount = 0,
Timeout = 0
};
_ = NativeFunctions.FlashWindowEx(stopFlashWInfo);
_ = NativeFunctions.FlashWindowEx(ref stopFlashWInfo);
}

private class FfmpegDownloadProgress : IProgress<ProgressInfo>
Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderWPF/Services/NativeFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static unsafe class NativeFunctions

[DllImport("user32.dll", EntryPoint = "FlashWindowEx", PreserveSig = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FlashWindowEx(FlashWInfo info);
public static extern bool FlashWindowEx([In] ref FlashWInfo info);

// https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-flashwinfo
[StructLayout(LayoutKind.Sequential)]
Expand Down

0 comments on commit e272112

Please sign in to comment.