From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。
---
HotelPms.Share.Windows/Component/RemovePeekMessage.cs | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 200 insertions(+), 0 deletions(-)
diff --git a/HotelPms.Share.Windows/Component/RemovePeekMessage.cs b/HotelPms.Share.Windows/Component/RemovePeekMessage.cs
new file mode 100644
index 0000000..a2e18e6
--- /dev/null
+++ b/HotelPms.Share.Windows/Component/RemovePeekMessage.cs
@@ -0,0 +1,200 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace HotelPms.Share.Windows.Component
+{
+ /// <summary>
+ /// �ۗ�����Ă���E�B���h�E���b�Z�[�W���폜
+ /// </summary>
+ public static class RemovePeekMessage
+ {
+ #region �萔
+ /// <summary>
+ /// �Y������E�B���h�E�ɍĕ`�悪�K�v��OS�����f�����Ƃ��Ƀ|�X�g����郁�b�Z�[�W
+ /// </summary>
+ private const int WM_PAINT = 0xF;
+
+ /// <summary>
+ /// �E�B���h�E�̃N���C�A���g�̈�Ń��[�U�[���}�E�X�̈ړ��������Ƃ��Ƀ|�X�g����郁�b�Z�[�W
+ /// </summary>
+ private const int WM_MOUSEMOVE = 0x200;
+
+ /// <summary>
+ /// �E�B���h�E�̃N���C�A���g�̈�Ń��[�U�[���}�E�X�̍��{�^�����������Ƃ��Ƀ|�X�g����郁�b�Z�[�W
+ /// </summary>
+ private const int WM_LBUTTONDOWN = 0x201;
+
+ /// <summary>
+ /// �E�B���h�E�̃N���C�A���g�̈�Ń��[�U�[���}�E�X�̍��{�^���𗣂����Ƃ��Ƀ|�X�g����郁�b�Z�[�W
+ /// </summary>
+ private const int WM_LBUTTONUP = 0x202;
+
+ /// <summary>
+ /// �}�E�X�|�C���^���̈�O�ɏo�����Ƀ|�X�g����郁�b�Z�[�W
+ /// </summary>
+ private const int WM_MOUSELEAVE = 0x2A3;
+
+ private const int WM_KEYFIRST = 0x100;
+ private const int WM_KEYLAST = 0x109;
+
+ private const int WM_MOUSEFIRST = 0x200;
+ private const int WM_MOUSELAST = 0x20D;
+
+ #endregion
+
+ #region �\����
+ /// <summary>
+ /// MSG �\���̌^
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct MSG
+ {
+ /// <summary>
+ /// �E�B���h�E�n���h��
+ /// </summary>
+ public IntPtr hWnd;
+ /// <summary>
+ /// MessageID
+ /// </summary>
+ public int msg;
+ /// <summary>
+ /// WParam�t�B�[���h�iMessageID���ƂɈႤ��)
+ /// </summary>
+ public IntPtr wParam;
+ /// <summary>
+ /// LParam�t�B�[���h�iMessageID���ƂɈႤ��)
+ /// </summary>
+ public IntPtr lParam;
+ /// <summary>
+ /// ����
+ /// </summary>
+ public int time;
+ /// <summary>
+ /// �J�[�\���ʒu�i�X�N���[�����W�j
+ /// </summary>
+ public POINTAPI pt;
+ }
+
+ /// <summary>
+ /// POINTAPI�\����
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct POINTAPI
+ {
+ /// <summary>
+ /// X���W
+ /// </summary>
+ public int x;
+ /// <summary>
+ /// Y���W
+ /// </summary>
+ public int y;
+ }
+ #endregion
+
+ #region �^
+ /// <summary>
+ /// wRemoveMsg�ŗ��p�\�ȃI�v�V����
+ /// </summary>
+ enum EPeekMessageOption
+ {
+ /// <summary>
+ /// �����チ�b�Z�[�W���L���[����폜���Ȃ�
+ /// </summary>
+ PM_NOREMOVE = 0,
+ /// <summary>
+ /// �����チ�b�Z�[�W���L���[����폜����
+ /// </summary>
+ PM_REMOVE
+ }
+ #endregion
+
+ #region DllImport
+ /// <summary>
+ /// �X���b�h�̃��b�Z�[�W�L���[�Ƀ��b�Z�[�W�����邩�ǂ������`�F�b�N��
+ /// ����A�w�肳�ꂽ�\���̂ɂ��̃��b�Z�[�W���i�[���܂�
+ /// </summary>
+ /// <param name="lpMsg"> ���b�Z�[�W�����i�[����AMSG �\���̌^�ϐ��̃|�C���^���w�肵�܂�</param>
+ /// <param name="hWnd">���b�Z�[�W���擾����E�B���h�E�̃n���h�����w�肵�܂��B�S�Ă̏ꍇ�� NULL</param>
+ /// <param name="wMsgFilterMin">���b�Z�[�W�̍ŏ��l���w�肵�A�t�B���^�����O���܂��B���Ȃ��ꍇ��0</param>
+ /// <param name="wMsgFilterMax">���b�Z�[�W�̍ő�l���w�肵�A�t�B���^�����O���܂��B���Ȃ��ꍇ��0</param>
+ /// <param name="wRemoveMsg">�����チ�b�Z�[�W���L���[���폜���邩�ۂ�</param>
+ /// <returns>���b�Z�[�W���擾�����Ƃ��� 0 �ȊO�A�擾���Ȃ������Ƃ��� 0</returns>
+ [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool PeekMessage(
+ out MSG lpMsg,
+ int hWnd,
+ int wMsgFilterMin,
+ int wMsgFilterMax,
+ EPeekMessageOption wRemoveMsg
+ );
+
+ /// <summary>
+ /// �w�肳�ꂽ MSG �\���̌^�ϐ��Ƀ��b�Z�[�W���i�[���܂�
+ /// </summary>
+ /// <param name="lpMsg">���b�Z�[�W�����i�[����AMSG �\���̌^�ϐ��̃|�C���^���w�肵�܂�</param>
+ /// <param name="hWnd">���b�Z�[�W���擾����E�B���h�E�̃n���h�����w�肵�܂��B�S�Ă̏ꍇ�� NULL</param>
+ /// <param name="wMsgFilterMin">���b�Z�[�W�̍ŏ��l���w�肵�A�t�B���^�����O���܂��B���Ȃ��ꍇ��0</param>
+ /// <param name="wMsgFilterMax">���b�Z�[�W�̍ő�l���w�肵�A�t�B���^�����O���܂��B���Ȃ��ꍇ��0</param>
+ /// <returns></returns>
+ [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool GetMessage(
+ out MSG lpMsg,
+ int hWnd,
+ int wMsgFilterMin,
+ int wMsgFilterMax
+ );
+
+ /// <summary>
+ /// �w�肳�ꂽ�E�B���h�E���b�Z�[�W���E�B���h�E�v���V�[�W���Ƀf�B�X�p�b�`���܂�
+ /// </summary>
+ /// <param name="lpMsg">�f�B�X�p�b�`���郁�b�Z�[�W���i�[���� MSG �\���̕ϐ��̃|�C���^���w�肵�܂�</param>
+ /// <returns>�E�B���h�E�v���V�[�W���̖߂�l</returns>
+ [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ private static extern IntPtr DispatchMessage(
+ out MSG lpMsg
+ );
+ #endregion
+
+ #region ���\�b�h
+ /// <summary>
+ /// �ۗ�����Ă���E�B���h�E���b�Z�[�W���폜���܂��B
+ /// </summary>
+ public static void Invoke()
+ {
+ //Console.WriteLine("�y���zRemovePeekMessage.Invoke():���̎��_�̃C�x���g���ׂč폜���s�J�n");
+ MSG wm;
+ while (PeekMessage(out wm, 0, WM_KEYFIRST, WM_KEYLAST, EPeekMessageOption.PM_REMOVE)) { }
+ while (PeekMessage(out wm, 0, WM_MOUSEFIRST, WM_MOUSELAST, EPeekMessageOption.PM_REMOVE)) { }
+
+
+#if false
+ System.Diagnostics.Debug.WriteLine("Invoke begin");
+ MSG wm;
+ while (true)
+ {
+ bool ret = PeekMessage(out wm, 0, 0, 0, EPeekMessageOption.PM_REMOVE);
+ System.Diagnostics.Debug.WriteLine(wm.msg.ToString());
+ System.Diagnostics.Debug.WriteLine(ret.ToString());
+ if (!ret) { break; }
+
+ switch (wm.msg)
+ {
+ case WM_LBUTTONUP:
+ case WM_MOUSELEAVE:
+ case WM_PAINT:
+ System.Diagnostics.Debug.WriteLine(wm.msg.ToString());
+ DispatchMessage(out wm);
+ break;
+ }
+ }
+ System.Diagnostics.Debug.WriteLine("Invoke end");
+#endif
+ }
+ #endregion
+ }
+}
--
Gitblit v1.10.0