![]() |
| ||
| How to know the User Log off or Shutdown the system Using VB Hello Experts When the system user Log off the system , shutdown and so on How to know that in vbcode Bcoz When user Log on i have vb application that automatically work, but when user logg off , shut down i have write code in application Please Help me Faisal |
| ||
| Re: How to know the User Log off or Shutdown the system Using VB place a shortcut of your vb application in windows startup folder. it will automatically launch your program whenever you will login to windows. and for shutdown, there is no coding required. windows already has a logging off utility that logs off each user from the current session before your computer is going to be restarted or shut down and unloads/closes all running processes/programs from memory. so make sure your program is running. you can ensure that by visiting the process list in windows task manager. now when a user logs off from his/her session windows will automatically unload your program and close it. |
| ||
| Re: How to know the User Log off or Shutdown the system Using VB hmmm.... do like shouvik suggest if u want your program automatically when windows start. |
| ||
| Re: How to know the User Log off or Shutdown the system Using VB instead of placing the shortcut if you wish to launch your program automatically though coding then you can try the following snippet :- PLACE THIS CODE IN A MODULE Option Explicit NOW IN YOUR FORM_LOAD EVENT() PLACE THIS CODE Dim strname as String hope this helps. regards Shouvik |
| ||
| Re: How to know the User Log off or Shutdown the system Using VB also u can write code to put your application on startup folder. so u no need to put your program manually on startup. see this following code : Private Sub GetStartUp() |
| ||
| Re: How to know the User Log off or Shutdown the system Using VB If you need to write custom code during the shutdown of the application and need to check to see if the user is logging off or if the machine is shutting down, use the forms QueryUnload event. Form_QueryUnload(cancel As Integer, unloadmode As Integer) UnloadMode will identify HOW the request to shutdown was received. You can set Cancel to True to halt the process, but in the event of a system shutdown, Windows may terminate the process. The list of UnloadMode constants can be found on the Microsoft MSDN site. http://msdn2.microsoft.com/en-us/lib...36(VS.60).aspx |
| All times are GMT -4. The time now is 4:03 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC