| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Member | Run a program before fully logging off Hey guys. I'm looking to write a progam that would backup a directory before fully logging off. The ideal possibility would be: User Clicks Logoff -> Program Runs -> Logoff completes when program exits. Do you guys know how to interrupt a logoff like this? Thanks, Ryan |
| |
| | #2 (permalink) |
| Eating Pie | Well if you run the command shutdown -r When you do the command to shutdown it stops the shutdown. It may work for logout try it and let me know how it works. I know there is also something in register which you can edit that will pause or slow down logout. Allowing for a backup. I don't recommand banging around in registry but you can reasearch abit. Maybe take a look at the coding on time logouts. Like at the libary. See how they did it. Find a way to stop the logout and than run the program than set it to logout. Something like that :S - Steve
__________________ I feel old. Last edited by iNod; 02-09-2006 at 09:59 AM. |
| |
| | #3 (permalink) |
| NamePros Member | What code langauage? I have some code i found and modified for vb .net to recognize a logoff command and then write to a db table and then logoff. Code: Private Shared WM_QUERYENDSESSION As Integer = &H11
Private Shared systemShutdown As Boolean = False
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_QUERYENDSESSION Then
' Insert command to run here
systemShutdown = True
End If
MyBase.WndProc(m)
End Sub 'WndProc
Private Sub Form1_Closing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If (systemShutdown) Then
systemShutdown = False
e.Cancel = False
End If
End Sub
|
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Great Scripts for Sale With Resale Rights! | Zeeble | Scripts For Sale | 20 | 01-04-2006 01:39 AM |
| NEW : Google AdSense(TM) Online Standard Terms and Conditions | Mark | Google Adsense | 3 | 11-04-2005 12:37 PM |
| DomainHop | Shan | PPC / CPC / CPM Programs | 82 | 06-06-2005 03:48 PM |
| Run an Affiliate Program? Read This | JNav | For Sale / Advertising Board | 0 | 04-09-2004 11:01 PM |