最简单方法是使用RegisterHotKey函数。在调用该函数后你的进程会在ALT-TAB按下时比系统先得到通知。然后在你的程序中处理WM_HOTKEY消息

解决方案 »

  1.   

    You can use system hook to hook keyboard messages and then determine if the 
    key are pressed. This is a sample code demonstrating how to setup a system 
    hook in C#:public class Win32Hook
    { [DllImport("kernel32")]
    public static extern int GetCurrentThreadId(); [DllImport( "user32", 
    CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)]
    public static extern int  SetWindowsHookEx(
    HookType idHook,
    HOOKPROC lpfn,
    int hmod,
    int dwThreadId); public enum HookType
    {
    WH_KEYBOARD = 2
    }

    public delegate int HOOKPROC(int nCode, int wParam, int lParam); public void SetHook()
    {
    // set the keyboard hook
    SetWindowsHookEx(HookType.WH_KEYBOARD,
    new HOOKPROC(this.MyKeyboardProc),
    0,
    GetCurrentThreadId());
    } public int MyKeyboardProc(int nCode, int wParam, int lParam)
    {
    //Perform your process
    return 0;
    }
    }And then you can install the hook procedure by the following code:Win32Hook hook = new Win32Hook();
    hook.SetHook();
      

  2.   

    用RegisterHotKey可以, stdotleo(大雨仔)说的不错,楼主可以参考一下.
      

  3.   

    using System.Runtime.InteropServices
    LockWorkStation();
      

  4.   

    http://www.3lsoft.com/download/info/414.htm
      

  5.   

    大雨仔写的E文看不懂,但通过拷备原代码,出现错误,提示要不要调试:( wltj(武林天骄)的方法不知道啥个实现,迷茫啊~~
      

  6.   

    怎么能做这样一个窗口,
    在按alt+tab时看不到它的图标。?????