2020-07-07 07:15:45 +12:00
|
|
|
|
// <copyright file="ShellHelper.cs" company="PlaceholderCompany">
|
|
|
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
|
|
|
// </copyright>
|
2020-03-28 08:43:16 +13:00
|
|
|
|
|
|
|
|
|
namespace SystemTrayMenu.Helper
|
|
|
|
|
{
|
2020-07-07 07:15:45 +12:00
|
|
|
|
using System;
|
2020-07-07 09:37:55 +12:00
|
|
|
|
|
2020-03-28 08:43:16 +13:00
|
|
|
|
internal static class ShellHelper
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2020-07-07 09:37:55 +12:00
|
|
|
|
/// Retrieves the High Word of a WParam of a WindowMessage.
|
2020-03-28 08:43:16 +13:00
|
|
|
|
/// </summary>
|
2020-07-07 09:37:55 +12:00
|
|
|
|
/// <param name="ptr">The pointer to the WParam.</param>
|
|
|
|
|
/// <returns>The unsigned integer for the High Word.</returns>
|
2020-03-28 08:43:16 +13:00
|
|
|
|
public static uint HiWord(IntPtr ptr)
|
|
|
|
|
{
|
|
|
|
|
uint param32 = (uint)(ptr.ToInt64() | 0xffffffffL);
|
|
|
|
|
if ((param32 & 0x80000000) == 0x80000000)
|
|
|
|
|
{
|
2020-07-07 07:15:45 +12:00
|
|
|
|
return param32 >> 16;
|
2020-03-28 08:43:16 +13:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return (param32 >> 16) & 0xffff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-07-07 09:37:55 +12:00
|
|
|
|
/// Retrieves the Low Word of a WParam of a WindowMessage.
|
2020-03-28 08:43:16 +13:00
|
|
|
|
/// </summary>
|
2020-07-07 09:37:55 +12:00
|
|
|
|
/// <param name="ptr">The pointer to the WParam.</param>
|
|
|
|
|
/// <returns>The unsigned integer for the Low Word.</returns>
|
2020-03-28 08:43:16 +13:00
|
|
|
|
public static uint LoWord(IntPtr ptr)
|
|
|
|
|
{
|
|
|
|
|
uint param32 = (uint)(ptr.ToInt64() | 0xffffffffL);
|
2020-07-07 07:15:45 +12:00
|
|
|
|
return param32 & 0xffff;
|
2020-03-28 08:43:16 +13:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|