Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
WindowsMessageHook.cs
Go to the documentation of this file.
1using System;
4
5namespace ReLogic.OS.Windows;
6
8{
10
11 private const int GWL_WNDPROC = -4;
12
14
16
17 private WndProcCallback _wndProc;
18
20
21 private bool disposedValue;
22
29
34
39
41 {
42 Message message = Message.Create(hWnd, msg, wParam, lParam);
43 if (InternalWndProc(ref message))
44 {
45 return message.Result;
46 }
47 return NativeMethods.CallWindowProc(_previousWndProc, message.HWnd, message.Msg, message.WParam, message.LParam);
48 }
49
50 private bool InternalWndProc(ref Message message)
51 {
52 foreach (IMessageFilter filter in _filters)
53 {
54 if (filter.PreFilterMessage(ref message))
55 {
56 return true;
57 }
58 }
59 return false;
60 }
61
62 protected virtual void Dispose(bool disposing)
63 {
64 if (!disposedValue)
65 {
67 disposedValue = true;
68 }
69 }
70
72 {
73 Dispose(disposing: false);
74 }
75
76 public void Dispose()
77 {
78 Dispose(disposing: true);
79 GC.SuppressFinalize(this);
80 }
81}
static IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
void AddMessageFilter(IMessageFilter filter)
virtual void Dispose(bool disposing)
delegate IntPtr WndProcCallback(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
void RemoveMessageFilter(IMessageFilter filter)
bool InternalWndProc(ref Message message)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static void SuppressFinalize(object obj)
Definition GC.cs:202
Definition GC.cs:8
static IntPtr GetFunctionPointerForDelegate(Delegate d)
Definition Marshal.cs:1457
static Message Create(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam)
Definition Message.cs:17
static readonly IntPtr Zero
Definition IntPtr.cs:18