监听消息:
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
protected override void WndProc(ref Message m)
{
    if( m.Msg == StartMessage.WM_QUERYENDSESSION )  //你想监听的消息
    {
      //你想做的事...
    }
    base.WndProc(ref m);
}Windows消息大全:
http://search.csdn.net/Expert/topic/1674/1674496.xml?temp=.8844416

解决方案 »

  1.   

    获得用户当前进程
    Thread.CurrentThread
      

  2.   

    如何通过WMI来操作?我是想知道如何获取一特定用户的进程情况
      

  3.   

    如何通过WMI来操作?WndProc是重构的方法,只要你的程序运行,它可以自动截取Window消息的。建议你把你的程序做成一个Server,在Window启动时运行,这样就可以截获注销登录消息了。我是想知道如何获取一特定用户的进程情况不太明白你的要求,是不是要找当前Windows登录用户的所有进程?
    进程的操作我也不太熟悉,你把你的问题问详细一些,看看有人回答吗。
      

  4.   

    IM聊好吗?我的QQ:123880505
    MSN:[email protected]
      

  5.   

    >>我是想知道如何获取一特定用户的进程情况this is an example in C++:Enumerating Logon Sessions
    http://www.codeproject.com/system/logonsessions.aspalso seeEventLog change notification in realtime
    http://fsilva.online.pt/node/view/5Understanding WMI Eventing 
    http://www.winnetmag.com/WindowsScripting/Article/ArticleID/9805/WindowsScripting_9805.html
      

  6.   

    WMI关键在于看WMI支持些什么,使用方法都一样的,就像访问数据库一样http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/computer_system_hardware_classes.asp