I want to hide my project list taskmgr.exe.
help?
Hide process ?
hi, i once used a piece of code that hided the proces from the taskmanager process list by hacking into and hiding it from the listbox.
The problem was that the memory needed by taskmanager went up as long as it was open.
I cant remember the name, but cant be that hard to find.
Cita de: Elemental Code en 4 Agosto 2012, 18:45 PM
hi, i once used a piece of code that hided the proces from the taskmanager process list by hacking into and hiding it from the listbox.
The problem was that the memory needed by taskmanager went up as long as it was open.
I cant remember the name, but cant be that hard to find.
es un codigo que esta por aca en el foro, lo oculta del listview que tiene el administrador de tareas.
maybe yo need this code.
Option Explicit
'Declaraciones Api
'*************************************
'Retorna un handle de ventana
Public Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
'Enumera las ventanas hijas a partir de una superior
Public Declare Function EnumChildWindows _
Lib "user32" ( _
ByVal hWndParent As Long, _
ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long
'Devuelve el texto de una ventana a partir del handle
Public Declare Function GetWindowText _
Lib "user32" _
Alias "GetWindowTextA" ( _
ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long) As Long
'REcupera el nombre de la clase de ventana a partir del handle
Public Declare Function GetClassName _
Lib "user32" _
Alias "GetClassNameA" ( _
ByVal hwnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long) As Long
Public Declare Function SendMessage _
Lib "user32" _
Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
'Apis para usar un temporizador
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
Private Declare Function GetWindowThreadProcessId _
Lib "user32" ( _
ByVal hwnd As Long, _
lpdwProcessId As Long) As Long
Private Declare Function ReadProcessMemory _
Lib "kernel32" ( _
ByVal hProcess As Long, _
lpBaseAddress As Any, _
lpBuffer As Any, _
ByVal nSize As Long, _
lpNumberOfBytesWritten As Long) As Long
Private Declare Function WriteProcessMemory _
Lib "kernel32" ( _
ByVal hProcess As Long, _
lpBaseAddress As Any, _
lpBuffer As Any, _
ByVal nSize As Long, _
lpNumberOfBytesWritten As Long) As Long
Private Declare Function OpenProcess _
Lib "kernel32" ( _
ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
'Constantes
'****************************************
Const PROCESS_VM_OPERATION = &H8
Const PROCESS_VM_READ = &H10
Const PROCESS_VM_WRITE = &H20
Const PROCESS_ALL_ACCESS = 0
Private Const PAGE_READWRITE = &H4&
Const MEM_COMMIT = &H1000
Const MEM_RESERVE = &H2000
Const MEM_DECOMMIT = &H4000
Const MEM_RELEASE = &H8000
Const MEM_FREE = &H10000
Const MEM_PRIVATE = &H20000
Const MEM_MAPPED = &H40000
Const MEM_TOP_DOWN = &H100000
Private Declare Function VirtualAllocEx _
Lib "kernel32" ( _
ByVal hProcess As Long, _
ByVal lpAddress As Long, _
ByVal dwSize As Long, _
ByVal flAllocationType As Long, _
ByVal flProtect As Long) As Long
Private Declare Function VirtualFreeEx _
Lib "kernel32" ( _
ByVal hProcess As Long, _
lpAddress As Any, _
ByVal dwSize As Long, _
ByVal dwFreeType As Long) As Long
Private Declare Function CloseHandle _
Lib "kernel32" ( _
ByVal hObject As Long) As Long
'Constantes para el ListView de la ventana del administrador de tareas
Private Const LVM_FIRST = &H1000
Private Const LVM_GETTITEMCOUNT& = (LVM_FIRST + 4)
Private Const ILVM_GETITEMW = (LVM_FIRST + 75)
Private Const LVIF_TEXT = &H1
Private Const LVM_DELETEITEM = 4104
Public Type LV_ITEM
mask As Long
iItem As Long
iSubItem As Long
state As Long
stateMask As Long
lpszText As Long 'LPCSTR
cchTextMax As Long
iImage As Long
lParam As Long
iIndent As Long
End Type
Type LV_TEXT
sItemText As String * 80
End Type
Public Function Procesos(ByVal hWnd2 As Long, _
lParam As String) As Boolean
Dim Nombre As String * 255, nombreClase As String * 255
Dim Nombre2 As String, nombreClase2 As String
Dim X As Long, Y As Long
X = GetWindowText(hWnd2, Nombre, 255)
Y = GetClassName(hWnd2, nombreClase, 255)
'Buffers
Nombre = Left$(Nombre, X)
nombreClase = Left$(nombreClase, Y)
Nombre2 = Trim$(Nombre)
nombreClase2 = Trim$(nombreClase)
'SysListView32 es el nombre de clase del LV del Administrador de T
If nombreClase2 = "SysListView32" And Nombre2 = "Procesos" Then
OcultarItems (hWnd2)
Exit Function
End If
If Nombre2 = "" And nombreClase2 = "" Then
Procesos = False
Else
Procesos = True
End If
End Function
'A esta función se le pasa el Handle del ListView del Administrador de tareas _
que es obtenido desde la función " Procesos "
Private Function OcultarItems(ByVal hListView As Long) ' As Variant
Dim pid As Long, tid As Long
Dim hProceso As Long, nElem As Long, lEscribiendo As Long, i As Long
Dim DirMemComp As Long, dwTam As Long
Dim DirMemComp2 As Long
Dim sLVItems() As String
Dim li As LV_ITEM
Dim lt As LV_TEXT
If hListView = 0 Then Exit Function
tid = GetWindowThreadProcessId(hListView, pid)
'Obtiene el número de items del ListView
nElem = SendMessage(hListView, LVM_GETTITEMCOUNT, 0, 0&)
If nElem = 0 Then Exit Function
ReDim sLVItems(nElem - 1)
li.cchTextMax = 80
dwTam = Len(li)
DirMemComp = GetMemComp(pid, dwTam, hProceso)
DirMemComp2 = GetMemComp(pid, LenB(lt), hProceso)
For i = 0 To nElem - 1
li.lpszText = DirMemComp2
li.cchTextMax = 80
li.iItem = i
li.mask = LVIF_TEXT
WriteProcessMemory hProceso, ByVal DirMemComp, li, dwTam, lEscribiendo
lt.sItemText = Space(80)
WriteProcessMemory hProceso, ByVal DirMemComp2, lt, LenB(lt), lEscribiendo
'Recupera un item del LV
Call SendMessage(hListView, LVM_GETITEMW, 0, ByVal DirMemComp)
Call ReadProcessMemory(hProceso, ByVal DirMemComp2, lt, LenB(lt), lEscribiendo)
'Acá verifica si lt.sItemText es el nombre del exe. Si está Lo elimina
If TrimNull(StrConv(lt.sItemText, vbFromUnicode)) = App.EXEName & ".exe" Then
Call SendMessage(hListView, LVM_DELETEITEM, i, 0)
Exit Function
End If
Next i
CloseMemComp hProceso, DirMemComp, dwTam
CloseMemComp hProceso, DirMemComp2, LenB(lt)
End Function
Private Function GetMemComp(ByVal pid As Long, _
ByVal memTam As Long, _
hProceso As Long) As Long
hProceso = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ _
Or PROCESS_VM_WRITE, False, pid)
GetMemComp = VirtualAllocEx(ByVal hProceso, ByVal 0&, ByVal memTam, _
MEM_RESERVE Or MEM_COMMIT, PAGE_READWRITE)
End Function
Private Sub CloseMemComp(ByVal hProceso As Long, _
ByVal DirMem As Long, _
ByVal memTam As Long)
Call VirtualFreeEx(hProceso, ByVal DirMem, memTam, MEM_RELEASE)
CloseHandle hProceso
End Sub
'Elimina los nulos
Private Function TrimNull(sInput As String) As String
Dim pos As Integer
pos = InStr(sInput, Chr$(0))
If pos Then
TrimNull = Left$(sInput, pos - 1)
Exit Function
End If
TrimNull = sInput
End Function
'Temporizador que cheaquea constantemente si el Administrador de tareas está ejecutandose
Public Sub TimerProc(ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long)
Dim Handle As Long
'Se obtiene el HWND del administrador de tareas
Handle = FindWindow(vbNullString, "Administrador de tareas de Windows")
'Si el administrador está visible el handle es distinto de 0 _
y se llama a EnumChildWindows pasandole el Handle del AT y la dirección _
de la función Procesos. EnumChildWindows obtiene el handle del ListView
If Handle <> 0 Then
EnumChildWindows Handle, AddressOf Procesos, 1
End If
End Sub
'Oculta y visualiza el item del proceso
Public Sub Ocultar(ByVal hwnd As Long)
App.TaskVisible = False
SetTimer hwnd, 0, 20, AddressOf TimerProc
End Sub
Public Sub Mostrar(ByVal hwnd As Long)
App.TaskVisible = True
KillTimer hwnd, 0
End Sub
Example
'Oculta el proceso del Administrador de Tareas
Private Sub Command1_Click()
Ocultar Me.hwnd
End Sub
'Visualiza el proceso
Private Sub Command2_Click()
Mostrar Me.hwnd
End Sub
Autor: L.Ascierto
Do not create topics with same answer Please.
LVM_GETITEMW Variable not defined
Declaraste mal
Private Const ILVM_GETITEMW = (LVM_FIRST + 75)
es:
Private Const LVM_GETITEMW = (LVM_FIRST + 75)
or
Private Const LVM_GETITEMW = &H104B