But what about the name of the user?

Shekhar Somani replied to alice johnson at 05-Jul-08 05:22
Thank you Alice. Actually, I already know how to receive and handle WM_WTSSESSION_CHANGE message. I am also aware of wParam values like WTS_CONSOLE_CONNECT and WTS_SESSION_UNLOCK and others.

My problem is, to know WHICH user has unlocked the computer. Let me explain...

1) User A turns the computer on and logs on
2) He hibernates/locks the computer
3) User B comes and logs on (User A is still there in inactive state)
4) User B locks the computer
5) User A unlocks the computer

Now in case 1 and 5, the User A has activated the computer, this is ONLY what I need to know. WM_WTSSESSION_CHANGE message in conjunction with WTS_SESSION_UNLOCK value can be used, but it would not let me know whether it is User A or User B who has unlocked the  computer.

Also let me specify why I need this, I am working on a utility that gives some information, plays custom random sound, etc. whenever a user unlocks the computer. Since in everyday home use, we don't log off. Instead, the last user who used the computer puts it in Standby or Hibernate mode, so mostly all the users are in "logged on" mode every time. Now I don't want my program to play the sounds for every user! It should be done only for a particular user.

I hope this somewhat long explanation gives an idea what I need. I think this is somewhat rare requirement. Now can u (or anyone else) help?


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  Getting to know the active (console connected) username - Shekhar Somani  04-Jul-08 02:34 2:34:52 PM
      REply - alice johnson  04-Jul-08 10:34 10:34:45 PM
          But what about the name of the user? - Shekhar Somani  05-Jul-08 05:22 5:22:48 AM
View Posts

promotion
Silverlight    WPF    WCF    WWF    LINQ   
JavaScript    AJAX    ASP.NET    XAML   
C#    VB.NET    VB 6.0    GDI+    IIS    XML   
.NET Generics    Anonymous Methods    Delegate   
Visual Studio .NET    Expression Blend    Virus   
Windows Vista    Windows XP    Windows Update   
Windows 2003 Server    Windows 2008 Server   
SQL Server    Microsoft Excel    Microsoft Word   
SharePoint    BizTalk    Virtual Earth   
.NET Compact Framework    Web Service   


"Everything" RSS / ATOM Feed Parser
How to send and receive messages through message queuing in .Net
How to Read text file as database
SQL Server 2005 Paging Performance Tip
Display code of web page.
Fully Scalable Excel File Importer class for .net using Microsoft Jet driver
Generic Chart Color Manager class that can be used for any charts
Helper class to style the infragistics wingrid
Using Reflection to detemine as Assembly Info in and out.
Helper class to play with Window (Owners and position)
Resolving displayname from the culture using the XmlLanguage and LanguageSpecificStringDictionary class