by www.cupidsystems.com (3 Submissions)
Category: Complete Applications
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
If a users attempts to shutdown/restart their computer while your application is still running, this simple piece of code will actually allow you to abort the request to shutdown. Can be very useful. Please mail me at [email protected] if you are facing any problems or www.shouvik.tk
Assumes
www.cisindia.net = Free Software. www.bnetsupport.com and www.vexat.net = Free Tutorials/Ebooks.
API DeclarationsDeclare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Declare Function AbortSystemShutdown Lib "advapi32.dll" Alias "AbortSystemShutdownA" (ByVal lpMachineName As String) As Long
Function GetName()
Dim lpBuff As String * 25
Dim ret As Long, ComputerName As String
ret = GetComputerName(lpBuff, 25)
ComputerName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
GetName = ComputerName
End Function
Private Sub Command1_Click()
AbortSystemShutdown (GetName)
End Sub
No comments have been posted about If a users attempts to shutdown/restart their computer while your application is still running. Why not be the first to post a comment about If a users attempts to shutdown/restart their computer while your application is still running.