zoukankan      html  css  js  c++  java
  • c# 钩子程序

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;
    namespace YL.Code
    {
        public class util
        {
            [DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Auto)]
            private extern static IntPtr FindWindow(string classname, string captionName);
            [DllImport("user32.dll", EntryPoint = "FindWindowEx", CharSet = CharSet.Auto)]
            private extern static IntPtr FindWindowEx(IntPtr parent, IntPtr child, string classname, string captionName);
            [DllImport("user32.dll")]
            static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPStr)] string lParam);
            [DllImport("user32.dll")]
            [returnMarshalAs(UnmanagedType.Bool)]
            static extern bool SetForegroundWindow(IntPtr hWnd);
     
            [DllImport("user32", EntryPoint = "EnableWindow")]
            public static extern int EnableWindow(int hwnd, int fEnable);
     
            [DllImport("user32.dll")]
            static extern bool EnableWindow(IntPtr hWnd, bool bEnable);
     
            [DllImport("user32.dll")]
            static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
     
            public void hideEscButton()
            {
                try
                {
     
                    IntPtr hWnd1 = FindWindow(null"照片处理");
                    IntPtr hWnd2 = FindWindowEx(hWnd1, IntPtr.Zero, "WindowsForms10.BUTTON.app.0.3b93019_r14_ad1"null);
                    if (hWnd2 == IntPtr.Zero) return;
     
                    uint WM_SHOWWINDOW = 0x18;
                    ShowWindow(hWnd2, 0);
                   
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
     
            }
        }
    }
    
  • 相关阅读:
    js创建form添加input项目并提交表单
    DataTable 修改列名 删除列 调整列顺序
    文件夹右键出取得管理员所有权选项
    c#多线程
    js用计时器加载大量dom
    c# 将html添加进剪贴板(带格式)
    landa语法
    c# @符号后面对 双引号转义
    asp.net web api CORS
    IIS中发布网站的问题
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/3270728.html
Copyright © 2011-2022 走看看