Hola atonio2005pee
No recuerdo de donde lo saqué, pues lo tengo de hace un par de años (quizas más) pero en un salvapantallas que hice en una oportunidad usé esto para evitar la ejecución del TaskMrg:
En un Módulo bas:
Option Explicit
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szexeFile As String * 260
End Type
Private Const TH32CS_SNAPPROCESS As Long = 2&
Private AplicationtoKill As Boolean
Private uProcess As PROCESSENTRY32
Private ProcessFound As Long
Private TheProcess As Long
Private exitCode As Long
Private hSnapshot As Long
Private NameOfExecutable As String
Private charsit As Long
Private Const Programa As String = "taskmgr.exe"
Private Declare Function TerminateProcess Lib "kernel32" (ByVal ApphProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal blnheritHandle As Long, ByVal dwAppProcessId As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, lProcessID As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Public Sub TimerProc(ByVal lhwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
On Error Resume Next
uProcess.dwSize = Len(uProcess)
hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
ProcessFound = ProcessFirst(hSnapshot, uProcess)
'Buscar Procesos activos
Do While ProcessFound
charsit = InStr(1, uProcess.szexeFile, Chr$(0))
'Extraer Nombre del Proceso
NameOfExecutable = LCase$(Left$(uProcess.szexeFile, charsit - 1))
DoEvents
' Si proceso activo = taskmgr.exe ...
If Right$(NameOfExecutable, Len(Programa)) = LCase$(Programa) Then
TheProcess = OpenProcess(&H400 Or &H1, False, uProcess.th32ProcessID)
' Cerrar Proceso
AplicationtoKill = TerminateProcess(TheProcess, exitCode)
Call CloseHandle(TheProcess)
End If
ProcessFound = ProcessNext(hSnapshot, uProcess)
DoEvents
Loop
Call CloseHandle(hSnapshot)
End Sub
y desde tu App lo llamas así:
SetTimer Me.hwnd, 0, 150, AddressOf TimerProc
y lo detienes así:
KillTimer Me.hwnd, 0
si bien el ScreenSaver lo hice en WinXP aun me funciona el bloqueo del TaskMgr en Win8.1...
Espero haber ayudado...
Saludos Cordiales
me parece que tenía igualmente algo para interceptar las combinaciones CTRL+ALT+SUP y CTRL+SHIFT+ESC, veré si lo ubico por ahí...