@@ -5,106 +5,14 @@ namespace Tvl.VisualStudio.MouseFastScroll.IntegrationTests.Harness
5
5
{
6
6
using System ;
7
7
using System . Runtime . InteropServices ;
8
- using System . Text ;
9
- using IBindCtx = Microsoft . VisualStudio . OLE . Interop . IBindCtx ;
10
- using IRunningObjectTable = Microsoft . VisualStudio . OLE . Interop . IRunningObjectTable ;
11
8
12
9
internal static class NativeMethods
13
10
{
14
- private const string Kernel32 = "kernel32.dll" ;
15
- private const string Ole32 = "ole32.dll" ;
16
11
private const string User32 = "User32.dll" ;
17
12
18
- public const int RPC_E_CALL_REJECTED = unchecked ( ( int ) 0x80010001 ) ;
19
- public const int RPC_E_SERVERCALL_RETRYLATER = unchecked ( ( int ) 0x8001010A ) ;
20
-
21
- public const uint GA_PARENT = 1 ;
22
- public const uint GA_ROOT = 2 ;
23
- public const uint GA_ROOTOWNER = 3 ;
24
-
25
- public const uint GW_HWNDFIRST = 0 ;
26
- public const uint GW_HWNDLAST = 1 ;
27
- public const uint GW_HWNDNEXT = 2 ;
28
- public const uint GW_HWNDPREV = 3 ;
29
- public const uint GW_OWNER = 4 ;
30
- public const uint GW_CHILD = 5 ;
31
- public const uint GW_ENABLEDPOPUP = 6 ;
32
-
33
- public const int HWND_NOTOPMOST = - 2 ;
34
- public const int HWND_TOPMOST = - 1 ;
35
- public const int HWND_TOP = 0 ;
36
- public const int HWND_BOTTOM = 1 ;
37
-
38
- public const uint INPUT_MOUSE = 0 ;
39
- public const uint INPUT_KEYBOARD = 1 ;
40
- public const uint INPUT_HARDWARE = 2 ;
41
-
42
- public const uint KEYEVENTF_NONE = 0x0000 ;
43
- public const uint KEYEVENTF_EXTENDEDKEY = 0x0001 ;
44
- public const uint KEYEVENTF_KEYUP = 0x0002 ;
45
- public const uint KEYEVENTF_UNICODE = 0x0004 ;
46
- public const uint KEYEVENTF_SCANCODE = 0x0008 ;
47
-
48
- public const uint SWP_NOSIZE = 0x0001 ;
49
- public const uint SWP_NOMOVE = 0x0002 ;
50
- public const uint SWP_NOZORDER = 0x0004 ;
51
- public const uint SWP_NOREDRAW = 0x008 ;
52
- public const uint SWP_NOACTIVATE = 0x0010 ;
53
- public const uint SWP_DRAWFRAME = 0x0020 ;
54
- public const uint SWP_FRAMECHANGED = 0x0020 ;
55
- public const uint SWP_SHOWWINDOW = 0x0040 ;
56
- public const uint SWP_HIDEWINDOW = 0x0080 ;
57
- public const uint SWP_NOCOPYBITS = 0x0100 ;
58
- public const uint SWP_NOOWNERZORDER = 0x0200 ;
59
- public const uint SWP_NOREPOSITION = 0x0200 ;
60
- public const uint SWP_NOSENDCHANGING = 0x0400 ;
61
- public const uint SWP_DEFERERASE = 0x2000 ;
62
- public const uint SWP_ASYNCWINDOWPOS = 0x4000 ;
63
-
64
- public const uint WM_GETTEXT = 0x000D ;
65
- public const uint WM_GETTEXTLENGTH = 0x000E ;
66
-
67
- public const uint MAPVK_VK_TO_VSC = 0 ;
68
- public const uint MAPVK_VSC_TO_VK = 1 ;
69
- public const uint MAPVK_VK_TO_CHAR = 2 ;
70
- public const uint MAPVK_VSC_TO_KV_EX = 3 ;
71
-
72
13
public const int SM_CXSCREEN = 0 ;
73
14
public const int SM_CYSCREEN = 1 ;
74
15
75
- public static readonly int SizeOf_INPUT = Marshal . SizeOf < INPUT > ( ) ;
76
-
77
- [ UnmanagedFunctionPointer ( CallingConvention . Winapi , SetLastError = false ) ]
78
- [ return : MarshalAs ( UnmanagedType . Bool ) ]
79
- public delegate bool WNDENUMPROC ( IntPtr hWnd , IntPtr lParam ) ;
80
-
81
- [ DllImport ( Kernel32 ) ]
82
- public static extern uint GetCurrentThreadId ( ) ;
83
-
84
- [ DllImport ( User32 , SetLastError = true ) ]
85
- [ return : MarshalAs ( UnmanagedType . Bool ) ]
86
- public static extern bool AttachThreadInput ( uint idAttach , uint idAttachTo , [ MarshalAs ( UnmanagedType . Bool ) ] bool fAttach ) ;
87
-
88
- [ DllImport ( User32 ) ]
89
- public static extern IntPtr GetForegroundWindow ( ) ;
90
-
91
- [ DllImport ( User32 ) ]
92
- public static extern uint GetWindowThreadProcessId ( IntPtr hWnd , [ Optional ] IntPtr lpdwProcessId ) ;
93
-
94
- [ DllImport ( User32 , SetLastError = true ) ]
95
- public static extern IntPtr SetActiveWindow ( IntPtr hWnd ) ;
96
-
97
- [ DllImport ( User32 , SetLastError = true ) ]
98
- public static extern IntPtr SetFocus ( IntPtr hWnd ) ;
99
-
100
- [ DllImport ( User32 , SetLastError = false ) ]
101
- [ return : MarshalAs ( UnmanagedType . Bool ) ]
102
- public static extern bool SetForegroundWindow ( IntPtr hWnd ) ;
103
-
104
- [ DllImport ( User32 , SetLastError = true ) ]
105
- [ return : MarshalAs ( UnmanagedType . Bool ) ]
106
- public static extern bool SetWindowPos ( IntPtr hWnd , [ Optional ] IntPtr hWndInsertAfter , int X , int Y , int cx , int cy , uint uFlags ) ;
107
-
108
16
[ DllImport ( User32 , CharSet = CharSet . Unicode ) ]
109
17
public static extern int GetSystemMetrics ( int nIndex ) ;
110
18
@@ -127,50 +35,5 @@ public struct POINT
127
35
public IntPtr x ;
128
36
public IntPtr y ;
129
37
}
130
-
131
- [ StructLayout ( LayoutKind . Explicit , CharSet = CharSet . Unicode , Pack = 8 ) ]
132
- public struct INPUT
133
- {
134
- [ FieldOffset ( 0 ) ]
135
- public uint Type ;
136
-
137
- [ FieldOffset ( 4 ) ]
138
- public MOUSEINPUT mi ;
139
-
140
- [ FieldOffset ( 4 ) ]
141
- public KEYBDINPUT ki ;
142
-
143
- [ FieldOffset ( 4 ) ]
144
- public HARDWAREINPUT hi ;
145
- }
146
-
147
- [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode , Pack = 8 ) ]
148
- public struct HARDWAREINPUT
149
- {
150
- public uint uMsg ;
151
- public ushort wParamL ;
152
- public ushort wParamH ;
153
- }
154
-
155
- [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode , Pack = 8 ) ]
156
- public struct KEYBDINPUT
157
- {
158
- public ushort wVk ;
159
- public ushort wScan ;
160
- public uint dwFlags ;
161
- public uint time ;
162
- public IntPtr dwExtraInfo ;
163
- }
164
-
165
- [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode , Pack = 8 ) ]
166
- public struct MOUSEINPUT
167
- {
168
- public int dx ;
169
- public int dy ;
170
- public uint mouseData ;
171
- public uint dwFlags ;
172
- public uint time ;
173
- public IntPtr dwExtraInfo ;
174
- }
175
38
}
176
39
}
0 commit comments