Menú

Mostrar Mensajes

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ú

Mensajes - Hasseds

#41
Estoy chequeando que el Tab Control es 1 (procesos)

el de Aplicaciones por ejemplo sería  0 (cero)
If SendMessage(HwTab, &H1300 + 11, 0, 0) = 0 Then



Private Const TCM_FIRST = &H1300  
Private Const TCM_GETCURSEL = (TCM_FIRST + 11)

#42
Form

Código (vb) [Seleccionar]


Option Explicit

Private Sub Form_Load()
 
 AutoRedraw = True
 Call SetTimer(hwnd, &H0, &H14, AddressOf TimerProc)

End Sub




Modulo

Código (vb) [Seleccionar]


Option Explicit

'Modulo: HwndTask
'Autor: Sergio Desanti (Hasseds)
'Test: XP (32 BIT) & W7/UAC (32 BIT)
'Retorno:  Hwnd del administrador de tareas

Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean
Private Declare Function EnumChildWindows Lib "user32" (ByVal hwndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal wIndx As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwprocessid As Long) As Long

Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long

Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Dim RetEnumHwndParent As Long
Dim RetEnumHwndChilds As String

Public Function HwndTask() As Long
   Call EnumWindows(AddressOf EnumHwndParent, ByVal &H0)
   HwndTask = RetEnumHwndParent
End Function

Private Function EnumHwndParent(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
   RetEnumHwndParent = 0
   RetEnumHwndChilds = ""
   If Not IsWinBorder(hwnd) = False And GetClase(hwnd) = "#32770" Then
     Call EnumChildWindows(hwnd, AddressOf EnumHwndChilds, ByVal &H0)
     If RetEnumHwndChilds = "DavesFrameClass" Then
       RetEnumHwndParent = hwnd
       Exit Function
     End If
   End If
   EnumHwndParent = True
End Function

Private Function EnumHwndChilds(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
   RetEnumHwndChilds = GetClase(hwnd)
   If RetEnumHwndChilds = "DavesFrameClass" Then Exit Function
   EnumHwndChilds = True
End Function

Private Function GetClase(ByVal hwnd As Long) As String
   GetClase = Space$(&H10) '
   GetClase = Left$(GetClase, GetClassName(hwnd, GetClase, &H10))
End Function

Private Function IsWinBorder(ByVal hwnd As Long) As Boolean
   If (GetWindowLong(hwnd, &HFFF0) And &H800000) = &H800000 Then IsWinBorder = True
End Function

Public Function PidFrontHwnd(ByVal hwnd As Long) As Long
    Call GetWindowThreadProcessId(hwnd, PidFrontHwnd)
End Function

Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)

   Dim HwTask As Long
   Dim HwChild As Long
   Dim HwTab As Long
   Dim HwLv As Long
   
   HwTask = HwndTask
   
   If HwTask <> 0 Then
     HwTab = FindWindowEx(HwTask, 0, "SysTabControl32", vbNullString)
     If SendMessage(HwTab, &H130B, 0, 0) = 1 Then
       HwChild = FindWindowEx(HwTask, 0, "#32770", vbNullString)
       HwLv = FindWindowEx(HwChild, 0, "SyslistView32", vbNullString)
     End If
   End If
   
   Form1.Cls
   Form1.Print HwTask
   Form1.Print HwLv
 
End Sub





#43
Hola, una pregunta, de que SyslistView32 queres obtener el Hwnd... el de aplicaciones o el de Procesos ? 
#44
Otra opción, no será la mas profesional, pero sí otra opción  :)



Option Explicit

Private Declare Function GetModuleFileNameExA Lib "psapi.dll" (ByVal hProcess As Long, ByVal hModule As Long, ByVal ModuleName As String, ByVal nSize As Long) As Long
Private Declare Function OpenProcess Lib "Kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Function PathExeWindow(ByVal hwnd As Long, ByRef sPath As String) As Long

  Dim HProc As Long, lngPid As Long, lnglen As Long, Bfpath As String * &H104
 
  Call GetWindowThreadProcessId(hwnd, lngPid)
  HProc = OpenProcess(&H410, &H0, lngPid)
  If HProc = 0 Then Exit Function
 
  lnglen = GetModuleFileNameExA(HProc, &H0, Bfpath, &H104)
  Call CloseHandle(HProc)
  If lnglen = 0 Then Exit Function
 
  sPath = Left$(Bfpath, lnglen)
  PathExeWindow = lnglen

End Function

Private Sub Form_Load()
 
  Dim sPath As String

  If PathExeWindow(hwnd, sPath) > 0 Then
    MsgBox sPath, , "sPath"
    MsgBox Mid$(sPath, 1, InStrRev(sPath, "\")), , "sDirectorio"
    MsgBox Mid$(sPath, InStrRev(sPath, "\") + 1), , "sFile"
    MsgBox Mid$(sPath, InStrRev(sPath, ".") + 1), , "sExtencion"
  End If

End Sub

#45
El numero de serie (Proporcionado por el frabricante) de un dispositivo, este deberiá ser unico y no cambiar al formatear, saludos
#47
Retorno = Seriales de Pen-Drives conectados

Código (vb) [Seleccionar]


Option Explicit

'Function: FlashSerials
'Autor   : Sergio Desanti (Hasseds)
'Thank   : Seba , Cobein, A.Desanti
'Test    : XP (32 BIT) - W7/UAC (32 BIT)
'Return  : Serial(ESN) de Pen-Drives conectados
'
Private Declare Function IIDFromString Lib "ole32" (ByVal lpsz As Long, ByRef lpiid As GUID) As Long
Private Declare Function SetupDiGetClassDevs Lib "setupapi.dll" Alias "SetupDiGetClassDevsA" (ByRef ClassGuid As GUID, ByVal Enumerator As Long, ByVal hwndParent As Long, ByVal flags As Long) As Long
Private Declare Function SetupDiEnumDeviceInterfaces Lib "setupapi.dll" (ByVal DeviceInfoSet As Long, ByVal DeviceInfoData As Long, ByRef InterfaceClassGuid As GUID, ByVal MemberIndex As Long, ByRef DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA) As Long
Private Declare Function SetupDiGetDeviceInterfaceDetail Lib "setupapi.dll" Alias "SetupDiGetDeviceInterfaceDetailA" (ByVal DeviceInfoSet As Long, ByRef DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA, DeviceInterfaceDetailData As Any, ByVal DeviceInterfaceDetailDataSize As Long, ByRef RequiredSize As Long, DeviceInfoData As Any) As Long
Private Declare Function SetupDiDestroyDeviceInfoList Lib "setupapi.dll" (ByVal DeviceInfoSet As Long) As Long


Private Type GUID
   Data1 As Long: Data2 As Integer: Data3 As Integer: Data4(7) As Byte
End Type

Private Type SP_DEVICE_INTERFACE_DATA
   cbSize As Long: InterfaceClassGuid As GUID: flags As Long: Reserved As Long
End Type

Private Type SP_DEVINFO_DATA
   cbSize As Long: ClassGuid As GUID: DevInst As Long: Reserved As Long
End Type

Private Type SP_DEVICE_INTERFACE_DETAIL_DATA
   cbSize As Long: strDevicePath As String * 260
End Type

Private Sub Form_Load()
    AutoRedraw = True
    Print FlashSerials
End Sub

Public Function FlashSerials() As String

   Dim TGUID As GUID
   
   Call IIDFromString(StrPtr("{a5dcbf10-6530-11d2-901f-00c04fb951ed}"), TGUID)
   
   Dim hDev As Long
   hDev = SetupDiGetClassDevs(TGUID, &H0, &H0, &H12)
   If hDev = -1 Then Exit Function

   Dim lCount        As Long
   Dim lSize         As Long
   Dim DEV_DETAIL    As SP_DEVICE_INTERFACE_DETAIL_DATA
   Dim DEV_INFO      As SP_DEVINFO_DATA
   Dim DEV_DATA      As SP_DEVICE_INTERFACE_DATA
   
   DEV_DATA.cbSize = Len(DEV_DATA)
   
   While SetupDiEnumDeviceInterfaces(hDev, &H0, TGUID, lCount, DEV_DATA) <> &H0
     Call SetupDiGetDeviceInterfaceDetail(hDev, DEV_DATA, ByVal &H0, &H0, lSize, ByVal &H0)
     DEV_DETAIL.cbSize = &H5
     DEV_INFO.cbSize = Len(DEV_INFO)
     Call SetupDiGetDeviceInterfaceDetail(hDev, DEV_DATA, DEV_DETAIL, ByVal lSize, &H0, DEV_INFO)
     If UBound(Split(DEV_DETAIL.strDevicePath, "#")) > 1 Then
       FlashSerials = FlashSerials & Split(UCase$(DEV_DETAIL.strDevicePath), "#")(2) & Chr$(&HD)
     End If
     lCount = lCount + 1
   Wend
   
   Call SetupDiDestroyDeviceInfoList(hDev)

End Function






#48
Declare Function WindowFromPoint Lib "user32" Alias "WindowFromPoint" (ByVal xPoint As Long, ByVal yPoint As Long) As Long

Saludos
#49

Dim Cadenas(2) As String

ReDim Preserve Cadenas(lineas)
#50
http://foro.elhacker.net/programacion_visual_basic/isway-t328357.0.html


     
   Dim ruta As String
   ruta = "c:\Archivos de Programa\asd\explorer.exe"
    ' ruta = Environ("ProgramFiles") & "\asd\explorer.exe"

   If InStr(LCase$(IsWay("Explorer.Exe")), LCase$(ruta)) > 0 Then
    MsgBox "Corre"
   Else
    MsgBox "no corre"
   End If