Cross Platform Application to allow control with a MIDI controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

// Author: Gockner, Simon
// Created: 2021-04-07
// Copyright(c) 2021 SimonG. All Rights Reserved.
using System;
using Lib.NotifyIcon.Windows.Native;
using Lib.NotifyIcon.Windows.Native.Types;
namespace Lib.NotifyIcon.Windows
{
/// <summary>
/// A native Win32 helper window encapsulation for dealing with the window messages sent by the notification icon
/// </summary>
internal class NotifyIconHelperWindow : NativeWindow
{
private readonly NotifyIcon _notifyIcon;
public NotifyIconHelperWindow(NotifyIcon notifyIcon) => _notifyIcon = notifyIcon;
/// <summary>
/// This function will receive all the system window messages relevant to our window.
/// </summary>
protected override IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{
switch (msg)
{
case (uint) CustomWindowsMessage.WmTrayMouse:
{
// Forward WM_TRAYMOUSE messages to the tray icon's window procedure
_notifyIcon.WndProc(hWnd, msg, wParam, lParam);
break;
}
default:
return base.WndProc(hWnd, msg, wParam, lParam);
}
return IntPtr.Zero;
}
}
}