最新下载
热门教程
- 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{ ///
相关文章
- 《弓箭传说2》新手玩法介绍 01-16
- 《地下城与勇士:起源》断桥烟雨多买多送活动内容一览 01-16
- 《差不多高手》醉拳龙技能特点分享 01-16
- 《鬼谷八荒》毕方尾羽解除限制道具推荐 01-16
- 《地下城与勇士:起源》阿拉德首次迎新春活动内容一览 01-16
- 《差不多高手》情圣技能特点分享 01-16