当前位置:首页 > 网络编程 > 软件语言 > .NET > 在C#中使用热键隐含窗口

在C#中使用热键隐含窗口

点击次数:58 次 发布日期:2008-11-06 08:08:03 作者:源代码网
源代码网推荐
广告载入中
我们曾经想过能够在我们的计算机上将窗口隐蔽起来,不想被从身边走过的老板看见。尝试便捷的Windows隐藏并定义热键来控制它们。下面我们将演示如何通过热键,我们将会用到DllImports of Win32 API、CallBacks/Delegates,定制事件与事件的句柄。
源代码网推荐
源代码网推荐using System;
源代码网推荐using System.Text;
源代码网推荐using System.Collections;
源代码网推荐using System.Runtime.InteropServices;
源代码网推荐
源代码网推荐namespace WindowHider
源代码网推荐{
源代码网推荐 /// <summary>
源代码网推荐 /// Object used to control a Windows Form.
源代码网推荐 /// </summary>
源代码网推荐 public class Window
源代码网推荐 {
源代码网推荐 /// <summary>
源代码网推荐 /// Win32 API Imports
源代码网推荐 /// </summary>
源代码网推荐 [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);
源代码网推荐
源代码网推荐 /// <summary>
源代码网推荐 /// Win32 API Constants for ShowWindowAsync()
源代码网推荐 /// </summary>
源代码网推荐 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;
源代码网推荐
源代码网推荐 /// <summary>
源代码网推荐 /// Private Fields
源代码网推荐 /// </summary>
源代码网推荐 private IntPtr m_hWnd;
源代码网推荐 private string m_Title;
源代码网推荐 private bool m_Visible = true;
源代码网推荐 private string m_Process;
源代码网推荐 private bool m_WasMax = false;
源代码网推荐
源代码网推荐 /// <summary>
源代码网推荐 /// Window Object"s Public Properties
源代码网推荐 /// </summary>
源代码网推荐 public IntPtr hWnd
源代码网推荐 {
源代码网推荐 get{return m_hWnd;}
源代码网推荐 }
源代码网推荐 public string Title
源代码网推荐 {
源代码网推荐 get{return m_Title;}
源代码网推荐 }
源代码网推荐 public string Process
源代码网推荐 {
源代码网推荐 get{return m_Process;}
源代码网推荐 }
源代码网推荐
源代码网推荐 /// <summary>
源代码网推荐 /// Sets this Window Object"s visibility
源代码网推荐 /// </summary>

源代码网推荐

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华