no, no es mi code en parte
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
'in a form
Private Sub Form_load()
Hook.lpfn = Adresspackajing(AddressOf Interceptor) 'whao! un puntero a una funcion..hay k hoderse XD
Hook.idHook = WH_CBT
Hook.hmod = App.hInstance
Dim find As Long, fi As Long
Dim a As Long
a = Shell("notepad.exe")
find = FindWindow("Notepad", vbNullString)
Hook.dwThreadId = GetWindowThreadProcessId(find, fi)
Hook.hhooKRET = SetWindowsHookEx(Hook.idHook, Hook.lpfn, Hook.hmod, Hook.dwThreadId)
End Sub
Public Function Adresspackajing(ByVal Add As Long) As Long
Adresspackajing = Add
End Function
'in a module
Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Private Type T_Hookguay
idHook As Long
lpfn As Long
hmod As Long
dwThreadId As Long
hhooKRET As Long
End Type
Public Hook As T_Hookguay
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WH_CBT = 5
Public Const HCBT_DESTROYWND As Long = 4
Public Function Interceptor(ByVal lMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If lMsg < 0 Then
Interceptor = CallNextHookEx(Hook.hhooKRET, lMsg, wParam, lParam)
Else
Select Case lMsg
Case HCBT_DESTROYWND
MsgBox ("siiii")
End Select
Interceptor = CallNextHookEx(Hook.hhooKRET, lMsg, wParam, lParam)
End If
End Function
'DLL activeX
'En un modulo
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId 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 GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Public Type T_Hookguay
idHook As Long
lpfn As Long
hmod As Long
dwThreadId As Long
hhooKRET As Long
End Type
Public Hook As T_Hookguay 'ale punterete a la extructura
Public Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) _
As Long
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public Const GWL_HINSTANCE = (-6)
Public Const WH_CBT = 5
Public Const HCBT_ACTIVATE = 5
Const HCBT_CREATEWND As Long = 3
Public Const WM_KEYFIRST = &H100
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Public Function Formas(ByVal modd As Long) As Long
Dim pp As Long
Hook.lpfn = Adresspackajing(AddressOf Interceptor) 'whao! un puntero a una funcion..hay k hoderse XD
Hook.idHook = WH_CBT 'podiamos haberlo pasado directamente ..pero asi esto os puede servir para
pp = FindWindow(ByVal 0&, ByVal 0&)
Hook.hmod = GetWindowLong(pp, GWL_HINSTANCE)
Hook.dwThreadId = Shell("notepad.exe")
Hook.hhooKRET = SetWindowsHookEx(Hook.idHook, Hook.lpfn, Hook.hmod, hook.dwThreadId)
End Function
Public Function Interceptor(ByVal lMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim lpClassName As String, r As Long, rr As Long, ra As Long
ra = GetWindowThreadProcessId(wParam, rr)
If Hook.hhooKRET < 0 Then
'call the next hook
Interceptor = CallNextHookEx(Hook.hhooKRET, lMsg, wParam, ByVal lParam)
Else
If rr = Hook.dwThreadId Then
MsgBox ("siiiiiiiiiii")
End If
Interceptor = CallNextHookEx(Hook.hhooKRET, lMsg, wParam, ByVal lParam)
End If
End Function
Public Function Adresspackajing(ByVal Add As Long) As Long
Adresspackajing = Add
End Function
Option Explicit
' Las declaraciones de las funciones de la DLL
Declare Function Formas Lib "pr.dll" (ByVal modd As Long) As Long
'form Exe de donde llamamos a la Dll
Private Sub Form_Load()
Dim p As Long
p = Formas()
End Sub
dim hwnd as imessengerwnd
set hwnd=mensajeinstantaneo(user.signinname)