Eabei.EabeiCore/Win32API.cs

(完整代码) 1KB

using Eabei.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Interop;


/**************************************************************************
*   
*   =======================================================================
*   运行版本    : 4.0.30319.42000
*   命名空间    : Eabei.EabeiCore
*   文件名称    : Win32API.cs
*   =======================================================================
*   创 建 者    : Besion
*   创建日期    : 2020/09/28 13:59:20 
*   邮箱地址    : 986905389@qq.com
*   个人主站    : /
*   功能描述    : 建设中...
*   使用说明    : 
*  
***************************************************************************/

namespace Eabei.EabeiCore
{
    public class Win32API : SingleInstance<Win32API>
    {
        [DllImport("user32.dll", EntryPoint = "MoveWindow", CharSet = CharSet.Auto, SetLastError = false)]
        public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint);

        [DllImport("user32.dll", EntryPoint = "ReleaseCapture", CharSet = CharSet.Auto, SetLastError = false)]
        public static extern bool ReleaseCapture();

        [DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = CharSet.Auto, SetLastError = false)]
        public static extern bool SendMessage(IntPtr hwnd, uint wMsg, uint wParam, long lParam);

        private const uint WM_SYSCOMMAND = 0x112, SC_MOVE = 0xF010, HTCAPTION = 2;

        public void Move(System.Windows.Window window)
        {
            try
            {
                ReleaseCapture();
                SendMessage(new WindowInteropHelper(window).Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
            }
            catch { }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。