mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-26 02:45:37 -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)]
|
||||
public static extern IntPtr CreateWindowEx(int dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, int dwStyle, int x, int y,
|
||||
int nWidth, int nHeight, uint hWndParent, int hMenu, int hInstance,
|
||||
int lpParam);
|
||||
int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance,
|
||||
IntPtr lpParam);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Processes a default windows procedure.
|
||||
/// </summary>
|
||||
[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>
|
||||
/// Registers the helper window class.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
/// Callback delegate which is used by the Windows API to
|
||||
/// submit window messages.
|
||||
/// </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>
|
||||
|
||||
@@ -187,14 +187,14 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
taskbarRestartMessageId = WinApi.RegisterWindowMessage("TaskbarCreated");
|
||||
|
||||
// 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 SILVERLIGHT
|
||||
throw new Exception("Message window handle was not a valid pointer.");
|
||||
#else
|
||||
throw new Win32Exception();
|
||||
throw new Win32Exception("Message window handle was not a valid pointer");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
/// <summary>
|
||||
/// Callback method that receives messages from the taskbar area.
|
||||
/// </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)
|
||||
{
|
||||
@@ -231,15 +231,14 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
/// or higher, this parameter can be used to resolve mouse coordinates.
|
||||
/// Currently not in use.</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;
|
||||
|
||||
switch (lParam)
|
||||
switch (lParam.ToInt32())
|
||||
{
|
||||
case 0x200:
|
||||
MouseEventReceived(MouseEvent.MouseMove);
|
||||
break;
|
||||
MouseEventReceived(MouseEvent.MouseMove); break;
|
||||
|
||||
case 0x201:
|
||||
MouseEventReceived(MouseEvent.IconLeftMouseDown);
|
||||
|
||||
Reference in New Issue
Block a user