.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> System Process >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Show the Shutdown Dialog Box and Switch User using VB.NET

Posted By:Hefin Dsouza       Posted Date: August 12, 2009    Points: 10    Category: System Process    URL: http://www.dotnetspark.com  
 

This code will allow you to switch users and also popup the Windows Shutdown Dialog
Declaration

Private Declare Function LockWorkStation Lib "user32.dll" () As Long

Private Declare Function ShutDownDialog Lib "shell32" Alias "#60" (ByVal any As Long) As Long
Usage

Private Sub ShowShutdown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ShutDownDialog(0)
End Sub

Private Sub SwitchUser(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
LockWorkStation()
End Sub

Regards
Hefin Dsouza

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend