'shutdown
Shell "Shutdown -s -f -t 0"
'logoff
Shell "Shutdown -l -f -t 0"
'restart
Shell "Shutdown -r -f -t 0"
Saturday, January 14, 2012
self deleter script
Sub KillMe()
Dim ff As Integer, batname As String, ext As String, batnum As Long
ChDir App.Path
ext = ".bat"
Do
batname = "DelMe" & Format(batnum) & ext
batnum = batnum + 1
Loop While Len(Dir(batname))
ext = ".exe"
ff = FreeFile
Open batname For Output As ff
Print #1, "@Echo off"
Print #1, ":Repeat"
Print #1, "del """ & App.EXEName & ext & """"
Print #1, "if exist """ & App.EXEName & ext & """ goto Repeat"
Print #1, "del " & batname
Close #1
batnum = Shell(batname, 0)
End
end sub
Dim ff As Integer, batname As String, ext As String, batnum As Long
ChDir App.Path
ext = ".bat"
Do
batname = "DelMe" & Format(batnum) & ext
batnum = batnum + 1
Loop While Len(Dir(batname))
ext = ".exe"
ff = FreeFile
Open batname For Output As ff
Print #1, "@Echo off"
Print #1, ":Repeat"
Print #1, "del """ & App.EXEName & ext & """"
Print #1, "if exist """ & App.EXEName & ext & """ goto Repeat"
Print #1, "del " & batname
Close #1
batnum = Shell(batname, 0)
End
end sub
Minimized hide script
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then
Me.Hide
End If
End Sub
If Me.WindowState = vbMinimized Then
Me.Hide
End If
End Sub
Disable mouse-keyboard
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Activate()
DoEvents
'block the mouse and keyboard input
BlockInput True
'wait 10 seconds before unblocking it
Sleep 10000
'unblock the mouse and keyboard input
BlockInput False
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Activate()
DoEvents
'block the mouse and keyboard input
BlockInput True
'wait 10 seconds before unblocking it
Sleep 10000
'unblock the mouse and keyboard input
BlockInput False
End Sub
date and time script
Private Sub Command1_Click()
MsgBox "The system date is " & Date & " " & Time()
End Sub
MsgBox "The system date is " & Date & " " & Time()
End Sub
creating batchfile script
Open "C:\demo.bat" For Append As 1
Print #1, Text1.Text
Close 1
Print #1, Text1.Text
Close 1
Local IP and HOST VB6 Script
Private Sub Command1_Click()
'gets local ip and displays it in the text control
Text1.Text = Winsock1.LocalIP
'gets local host name and displays it in the text control
Text2.Text = Winsock1.LocalHostName
End Sub
'gets local ip and displays it in the text control
Text1.Text = Winsock1.LocalIP
'gets local host name and displays it in the text control
Text2.Text = Winsock1.LocalHostName
End Sub
Subscribe to:
Posts (Atom)