最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Window Hiding with C#(ZT)
时间:2022-07-02 11:37:55 编辑:袖梨 来源:一聚教程网
Introduction
Ever wanted to completely hide all the crap on your machine that you're not supposed to be looking at when your boss walks by? Try this handy Window Hider utility and all you will have to do is press a customizable hotkey.
This source project will demonstrate the implementation of hot keys, enumerable collections, enums, binary serialization, DllImports of Win32 API, Window Enumeration, CallBacks/Delegates, Custom Events and Event Handlers, and more. It's quite a bit of code to look through but some of you may find it interesting.
The guts of the application is based in the Window and Windows classes that enumerate and hide the open windows your choose: using System;using System.Text;using System.Collections;using System.Runtime.InteropServices; namespace WindowHider{ /// /// Object used to control a Windows Form. /// public class Window { /// /// Win32 API Imports /// [DllImport("user32.dll")] private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); [DllImport("user32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("user32.dll")] private static extern bool IsIconic(IntPtr hWnd); [DllImport("user32.dll")] private static extern bool IsZoomed(IntPtr hWnd); [DllImport("user32.dll")] private static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll")] private static extern IntPtr GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId); [DllImport("user32.dll")] private static extern IntPtr AttachThreadInput(IntPtr idAttach, IntPtr idAttachTo, int fAttach); /// /// Win32 API Constants for ShowWindowAsync() /// private const int SW_HIDE = 0; private const int SW_SHOWNORMAL = 1; private const int SW_SHOWMINIMIZED = 2; private const int SW_SHOWMAXIMIZED = 3; private const int SW_SHOWNOACTIVATE = 4; private const int SW_RESTORE = 9; private const int SW_SHOWDEFAULT = 10; /// /// Private Fields /// private IntPtr m_hWnd; private string m_Title; private bool m_Visible = true; private string m_Process; private bool m_WasMax = false; /// /// Window Object's Public Properties /// public IntPtr hWnd { get{return m_hWnd;} } &nbs
Ever wanted to completely hide all the crap on your machine that you're not supposed to be looking at when your boss walks by? Try this handy Window Hider utility and all you will have to do is press a customizable hotkey.
This source project will demonstrate the implementation of hot keys, enumerable collections, enums, binary serialization, DllImports of Win32 API, Window Enumeration, CallBacks/Delegates, Custom Events and Event Handlers, and more. It's quite a bit of code to look through but some of you may find it interesting.
The guts of the application is based in the Window and Windows classes that enumerate and hide the open windows your choose: using System;using System.Text;using System.Collections;using System.Runtime.InteropServices; namespace WindowHider{ ///
相关文章
- 人们熟悉的寄居蟹属于以下哪种分类 神奇海洋11月21日答案 11-21
- 第五人格11.22共研服有什么更新 11月22日共研服更新内容介绍 11-21
- 原神恰斯卡怎么培养 11-21
- 无期迷途四星装束是谁 11-21
- 王者荣耀帝丹高中校服怎么获得 11-21
- 光遇姆明季后续版本怎么玩 11-21