Skip to content

Commit b203e8a

Browse files
committed
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck into BugBlipper
2 parents b7ffcb9 + f49d175 commit b203e8a

File tree

10 files changed

+639
-554
lines changed

10 files changed

+639
-554
lines changed

RetailCoder.VBE/Common/RubberduckHooks.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Runtime.InteropServices;
5-
using System.Windows.Forms;
65
using Rubberduck.Common.Hotkeys;
76
using Rubberduck.Common.WinAPI;
87

@@ -120,7 +119,7 @@ public void Dispose()
120119
Detach();
121120
}
122121

123-
private IntPtr WindowProc(IntPtr hWnd, int uMsg, int wParam, int lParam)
122+
private IntPtr WindowProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
124123
{
125124
try
126125
{
@@ -171,14 +170,9 @@ private IntPtr WindowProc(IntPtr hWnd, int uMsg, int wParam, int lParam)
171170
return User32.CallWindowProc(_oldWndProc, hWnd, uMsg, wParam, lParam);
172171
}
173172

174-
/// <summary>
175-
/// Gets the integer portion of a word
176-
/// </summary>
177-
private static int LoWord(int dw)
173+
private static int LoWord(IntPtr dw)
178174
{
179-
return (dw & 0x8000) != 0
180-
? 0x8000 | (dw & 0x7FFF)
181-
: dw & 0xFFFF;
175+
return unchecked((short)(uint)dw);
182176
}
183177

184178
private IntPtr GetWindowThread(IntPtr hWnd)

RetailCoder.VBE/Common/WinAPI/User32.cs

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,44 +46,9 @@ public static class User32
4646
[DllImport("user32.dll")]
4747
public static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, WndProc dwNewLong);
4848

49-
/// <summary>
50-
/// Changes an attribute of the specified window.
51-
/// The function also sets the 32-bit (long) value at the specified offset into the extra window memory.
52-
/// </summary>
53-
/// <param name="hWnd">A handle to the window and, indirectly, the class to which the window belongs.</param>
54-
/// <param name="nIndex">The zero-based offset to the value to be set.
55-
/// Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer.
56-
/// <see cref="WindowLongFlags"/>.</param>
57-
/// <param name="dwNewLong">The replacement value.</param>
58-
/// <returns>The return value specifies the result of the message processing and depends on the message sent.</returns>
59-
//public static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex, WndProc dwNewLong)
60-
//{
61-
// return IntPtr.Size == 8
62-
// ? SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
63-
// : new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
64-
//}
65-
66-
//[DllImport("user32.dll", EntryPoint = "SetWindowLong")]
67-
//private static extern int SetWindowLong32(IntPtr hWnd, WindowLongFlags nIndex, int dwNewLong);
68-
69-
//[DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")]
70-
//private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong);
71-
72-
73-
/// <summary>
74-
/// Passes message information to the specified window procedure.
75-
/// </summary>
76-
/// <param name="lpPrevWndFunc">The previous window procedure.
77-
/// If this value is obtained by calling the GetWindowLong function with the nIndex parameter set to GWL_WNDPROC or DWL_DLGPROC,
78-
/// it is actually either the address of a window or dialog box procedure, or a special internal value meaningful only to CallWindowProc.</param>
79-
/// <param name="hWnd">A handle to the window procedure to receive the message.</param>
80-
/// <param name="Msg">The message.</param>
81-
/// <param name="wParam">Additional message-specific information. The contents of this parameter depend on the value of the Msg parameter.</param>
82-
/// <param name="lParam">Additional message-specific information. The contents of this parameter depend on the value of the Msg parameter.</param>
83-
/// <returns></returns>
8449
[DllImport("user32.dll")]
85-
public static extern IntPtr CallWindowProc(WndProc lpPrevWndFunc, IntPtr hWnd, int Msg, int wParam, int lParam);
86-
public delegate IntPtr WndProc(IntPtr hWnd, int uMsg, int wParam, int lParam);
50+
public static extern IntPtr CallWindowProc(WndProc lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
51+
public delegate IntPtr WndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam);
8752

8853
/// <summary>
8954
/// A pointer to the hook procedure.

0 commit comments

Comments
 (0)