openMSX
AltSpaceSuppressor.hh
Go to the documentation of this file.
1 #ifndef ALTSPACESUPPRESSOR_HH
2 #define ALTSPACESUPPRESSOR_HH
3 
4 #ifdef _WIN32
5 #include <windows.h>
6 
7 namespace openmsx {
8 
9 // Utility class that stacks a WindowLongPtr value
10 class WindowLongPtrStacker
11 {
12 public:
13  WindowLongPtrStacker(int index, LONG_PTR value);
14  void Push(HWND hWndArg);
15  void Pop();
16  LONG_PTR GetOldValue();
17 private:
18  HWND hWnd;
19  int nIndex;
20  LONG_PTR oldValue, newValue;
21 };
22 
23 
24 // Suppressor of ALT+SPACE windows messages
25 class AltSpaceSuppressor
26 {
27 public:
28  static void Start(HWND hWnd);
29  static void Stop();
30 private:
31  static WindowLongPtrStacker procStacker;
32  static LRESULT CALLBACK InterceptorWndProc(
33  HWND hWnd,
34  UINT message,
35  WPARAM wParam,
36  LPARAM lParam);
37  static bool SuppressAltSpace(
38  HWND hWnd,
39  UINT message,
40  WPARAM wParam,
41  LPARAM lParam,
42  LRESULT* outResult);
43 };
44 
45 } // namespace openmsx
46 
47 #endif
48 
49 #endif
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5