VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

If a users attempts to shutdown/restart their computer while your application is still running

www.cupidsystems.com  (3 Submissions)   Complete Applications   Visual Basic 5.0   Beginner   Wed 3rd February 2021

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 Declarations
Declare 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

Rate If a users attempts to shutdown/restart their computer while your application is still running (3(3 Vote))
If a users attempts to shutdown/restart their computer while your application is still running.bas

If a users attempts to shutdown/restart their computer while your application is still running Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters