mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-02-17 02:51:51 -05:00
FIX Supporting x64 for .NET and above (NTFY-1)
git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@171 9f600761-6f11-4665-b6dc-0185e9171623
This commit is contained in:
@@ -21,15 +21,15 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
|||||||
[DllImport("USER32.DLL", EntryPoint = "CreateWindowExW", SetLastError = true)]
|
[DllImport("USER32.DLL", EntryPoint = "CreateWindowExW", SetLastError = true)]
|
||||||
public static extern IntPtr CreateWindowEx(int dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
|
public static extern IntPtr CreateWindowEx(int dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
|
||||||
[MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, int dwStyle, int x, int y,
|
[MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, int dwStyle, int x, int y,
|
||||||
int nWidth, int nHeight, uint hWndParent, int hMenu, int hInstance,
|
int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance,
|
||||||
int lpParam);
|
IntPtr lpParam);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes a default windows procedure.
|
/// Processes a default windows procedure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport("USER32.DLL")]
|
[DllImport("USER32.DLL")]
|
||||||
public static extern long DefWindowProc(IntPtr hWnd, uint msg, uint wparam, uint lparam);
|
public static extern IntPtr DefWindowProc(IntPtr hWnd, uint msg, IntPtr wparam, IntPtr lparam);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers the helper window class.
|
/// Registers the helper window class.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
|||||||
/// Callback delegate which is used by the Windows API to
|
/// Callback delegate which is used by the Windows API to
|
||||||
/// submit window messages.
|
/// submit window messages.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate long WindowProcedureHandler(IntPtr hwnd, uint uMsg, uint wparam, uint lparam);
|
public delegate IntPtr WindowProcedureHandler(IntPtr hwnd, uint uMsg, IntPtr wparam, IntPtr lparam);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -187,14 +187,14 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
|||||||
taskbarRestartMessageId = WinApi.RegisterWindowMessage("TaskbarCreated");
|
taskbarRestartMessageId = WinApi.RegisterWindowMessage("TaskbarCreated");
|
||||||
|
|
||||||
// Create the message window
|
// Create the message window
|
||||||
MessageWindowHandle = WinApi.CreateWindowEx(0, WindowId, "", 0, 0, 0, 1, 1, 0, 0, 0, 0);
|
MessageWindowHandle = WinApi.CreateWindowEx(0, WindowId, "", 0, 0, 0, 1, 1, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
|
||||||
|
|
||||||
if (MessageWindowHandle == IntPtr.Zero)
|
if (MessageWindowHandle == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
#if SILVERLIGHT
|
#if SILVERLIGHT
|
||||||
throw new Exception("Message window handle was not a valid pointer.");
|
throw new Exception("Message window handle was not a valid pointer.");
|
||||||
#else
|
#else
|
||||||
throw new Win32Exception();
|
throw new Win32Exception("Message window handle was not a valid pointer");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback method that receives messages from the taskbar area.
|
/// Callback method that receives messages from the taskbar area.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private long OnWindowMessageReceived(IntPtr hwnd, uint messageId, uint wparam, uint lparam)
|
private IntPtr OnWindowMessageReceived(IntPtr hwnd, uint messageId, IntPtr wparam, IntPtr lparam)
|
||||||
{
|
{
|
||||||
if (messageId == taskbarRestartMessageId)
|
if (messageId == taskbarRestartMessageId)
|
||||||
{
|
{
|
||||||
@@ -231,15 +231,14 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
|||||||
/// or higher, this parameter can be used to resolve mouse coordinates.
|
/// or higher, this parameter can be used to resolve mouse coordinates.
|
||||||
/// Currently not in use.</param>
|
/// Currently not in use.</param>
|
||||||
/// <param name="lParam">Provides information about the event.</param>
|
/// <param name="lParam">Provides information about the event.</param>
|
||||||
private void ProcessWindowMessage(uint msg, uint wParam, uint lParam)
|
private void ProcessWindowMessage(uint msg, IntPtr wParam, IntPtr lParam)
|
||||||
{
|
{
|
||||||
if (msg != CallbackMessageId) return;
|
if (msg != CallbackMessageId) return;
|
||||||
|
|
||||||
switch (lParam)
|
switch (lParam.ToInt32())
|
||||||
{
|
{
|
||||||
case 0x200:
|
case 0x200:
|
||||||
MouseEventReceived(MouseEvent.MouseMove);
|
MouseEventReceived(MouseEvent.MouseMove); break;
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x201:
|
case 0x201:
|
||||||
MouseEventReceived(MouseEvent.IconLeftMouseDown);
|
MouseEventReceived(MouseEvent.IconLeftMouseDown);
|
||||||
|
|||||||
Reference in New Issue
Block a user