c# 钩子程序
2024-09-29 01:40:31
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")]
[return: MarshalAs(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);
} }
}
}
最新文章
- python 之sqlalchemy many to many
- C++ GPU &;&; CPU
- java连接mysql(一)
- Deeplearning原文作者Hinton代码注解
- 跌跌撞撞,用MAVEN看图说话的编译了一个JAR出来
- 【零基础学习iOS开发】【02-C语言】09-流程控制
- ANDROID_MARS学习笔记_S01_009Relative_LAYOUT例子
- [每日一题] OCP1z0-047 :2013-08-14 如何理解USING INDEX?...................................41
- Java System类
- 『Python』 多线程 共享变量的实现
- python切片练习
- windows下用cordova构建android app
- [SDOI2012]Longge的问题
- 423 重温Java Script and jQuery 葵花宝典 Bootstrap
- Python3 open函数
- net core体系-web应用程序-4asp.net core2.0 项目实战(1)-9项目各种全局帮助类
- gitlab+jenkins+tomcat war包部署(此文有新版本)
- 20155205 《Java程序设计》实验一(Java开发环境的熟悉)实验报告
- In case of failure
- Ultra-QuickSort---poj2299 (归并排序.逆序数.树状数组.离散化)