HOLA!!!
Bueno, esta es una borma que arme hace un tiempo, es de esas que no podes clickear el boton (igual aunque lo clickees no hace nada XD) y cuando el contador llega a 0 te reinicia el equipo.
(http://img69.imageshack.us/img69/6676/dibujopvj.jpg)
(para cerrarlo ctrl + alt + supr y poner finalizar tarea muchas veces hasta que aparezca que no responde y ponen finalizar ahora)
Descargar URL:
http://www.mediafire.com/?tove2cf972o37vt
GRACIAS POR LEER!!!
Yo lo haría así:
Option Explicit
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, ByRef TokenHandle As Long) As Long
Private Declare Function AdjustTokenPrivileges Lib "advapi32" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, ByRef NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long
Private Declare Function LookupPrivilegeValueA Lib "advapi32" (ByVal lpSystemName As String, ByVal lpName As String, ByRef lpLuid As LUID) As Long
Private Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Type LUID
UsedPart As Long
IgnoredForNowHigh32BitPart As Long
End Type
Private Type TOKEN_PRIVILEGES
PrivilegeCount As Long
TheLuid As LUID
Attributes As Long
End Type
Private Const Pi As Double = 3.14159265358979
Private Const lngDistance As Long = &HC8
Private Const HWND_TOPMOST As Long = -1
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_NOMOVE As Long = &H2
Private Const TOKEN_ADJUST_PRIVILEGES As Long = &H20
Private Const TOKEN_QUERY As Long = &H8
Private Const SE_PRIVILEGE_ENABLED As Long = &H2
Private Const EWX_SHUTDOWN As Long = &H1
Private Const EWX_FORCE As Long = &H4
Private bytCount As Byte
Private lngHeight As Long
Private lngWidth As Long
Private sinAngle As Single
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Command1.Move Rnd * lngWidth, Rnd * lngHeight
End Sub
Private Sub Form_Load()
Beep
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
With Command1
lngHeight = Height - .Height * 2
lngWidth = Width - .Width
End With
bytCount = 15
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = True
End Sub
Private Sub Timer1_Timer()
bytCount = bytCount + 1
Label2.Caption = CStr(lngSecondsToWait - bytCount) & " seg"
sinAngle = 6 * bytCount
With Line1
.X2 = .X1 + Cos((sinAngle - 90) / 180 * Pi) * lngDistance
.Y2 = .Y1 + Sin((sinAngle - 90) / 180 * Pi) * lngDistance
End With
If bytCount = lngSecondsToWait Then
ForzeShutDown
End
End If
End Sub
Private Sub ForzeShutDown()
Dim myLuid As LUID
Dim tkpFinal As TOKEN_PRIVILEGES
Dim tkpPrevious As TOKEN_PRIVILEGES
Dim lngBuffer As Long
Dim lngTokenHwnd As Long
Dim lngProcessHwnd As Long
lngProcessHwnd = GetCurrentProcess
OpenProcessToken lngProcessHwnd, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, lngTokenHwnd
LookupPrivilegeValueA vbNullString, "SeShutdownPrivilege", myLuid
With tkpFinal
.PrivilegeCount = 1
.TheLuid = myLuid
.Attributes = SE_PRIVILEGE_ENABLED
End With
AdjustTokenPrivileges lngTokenHwnd, False, tkpFinal, Len(tkpPrevious), tkpPrevious, lngBuffer
ExitWindowsEx EWX_SHUTDOWN Or EWX_FORCE, True
End Sub
Tambien puedes hacer un hook para deshabilitar el Ctr+Alt+Supr, porque creo que SystemParametersInfo() no funciona en W7...
DoEvents! :P
Me viene bien puesto que quiero saber cómo mostrar un período de tiempo en un label (que se nota que no es del mismo, hehe)... Gracias por compartir 79137913 ;-)
Un saludo
PD Dejo lo de Mr.Frog para un futuro no muy lejano (espero)... :silbar:
HOLA!!!
JAJAJA, me encanta, siempre salen versiones hiper mejoradas XD.
;-) ;-) ;-) ;-) ;-)
P.D: Estoy aburrido, Alguien arme un Reto :silbar:
P.D2: @Herio XD que se note que no es del mismo no hay problema, es cuestion de ubicar bien el label2 sino podes hacer algo asi:
Label1.Caption ="Se ha activado la Autodestruccion del equipo, para cancelar presione el boton Abortar, sino espere " & (60 - Z) & " seg a que empiece la Autodestruccion"
GRACIAS POR LEER!!!
CitarLabel1.Caption ="Se ha activado la Autodestruccion del equipo, para cancelar presione el boton Abortar, sino espere " & (60 - Z) & " seg a que empiece la Autodestruccion"
¡No se me había ocurrido! :-[
Muchas gracias 79137913
Un saludo
El de Psyke1 no me anduvo, la api esa es al pedo xD, con el shutdown -s -f bastaba
Cita de: XXX-ZERO-XXX en 11 Febrero 2011, 21:42 PM
El de Psyke1 no me anduvo, la api esa es al pedo xD, con el shutdown -s -f bastaba
No digas barbaridades, esa es una forma muy fea de hacerlo...
Ya actualicé el código.
DoEvents! :P
Bueno pero no te enojes psyke1 xD