elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Listar Ventanas, problemas con IDEOwner
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Listar Ventanas, problemas con IDEOwner  (Leído 1,574 veces)
LeandroA
Moderador
***
Desconectado Desconectado

Mensajes: 760


www.leandroascierto.com


Ver Perfil WWW
Listar Ventanas, problemas con IDEOwner
« en: 12 Mayo 2009, 08:09 am »

hola, tengo un problema con este codigo, estoy listando todas las ventanas que aparecen en la barra de Tareas, y cuando le doy clic en el list me imprime la ventana, pero el problema es con el IDE de visual basic si no esta minimizado, el problema es que la ventana se llama wndclass_desked_gsk pero la que en realidad el que tiene el ExStyle WS_EX_APPWINDOW es IDEOwner como puedo obtener la ventana wndclass_desked_gsk  a partir de IDEOwner


en un modulo
Código:
Option Explicit
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) 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 EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function PrintWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long

Private Const GWL_EXSTYLE As Long = -20
Private Const WS_EX_APPWINDOW As Long = &H40000
Private Const WS_EX_WINDOWEDGE As Long = &H100&

Dim arr() As Long

Public Function fEnumWindows() As Variant
    ReDim arr(0)
    Call EnumWindows(AddressOf fEnumWindowsCallBack, GetDesktopWindow)
    fEnumWindows = arr
End Function

Private Function fEnumWindowsCallBack(ByVal hWnd As Long, ByVal lParam As Long) As Long
    If IsWindowVisible(hWnd) Then
        If IsExStyle(hWnd, WS_EX_APPWINDOW) Or GetWinClassName(hWnd) = "CabinetWClass" Then
            arr(UBound(arr)) = hWnd
            ReDim Preserve arr(UBound(arr) + 1)
        End If
    End If
fEnumWindowsCallBack = True
End Function

Public Function GetWinText(ByVal hWnd As Long)
    Dim MyStr As String
    MyStr = String(100, Chr$(0))
    GetWindowText hWnd, MyStr, 100
    GetWinText = Left$(MyStr, InStr(MyStr, Chr$(0)) - 1)
End Function

Public Function GetWinClassName(hWnd As Long) As String
    Dim lpClassName As String
    Dim Ret As Long
    lpClassName = Space(256)
    Ret = GetClassName(hWnd, lpClassName, 256)
    GetWinClassName = Left$(lpClassName, Ret)
End Function

Private Function IsExStyle(hWnd As Long, ExStyle As Long) As Boolean
    IsExStyle = (GetWindowLong(hWnd, GWL_EXSTYLE) And ExStyle) = ExStyle
End Function


en un formulario con un picture1 y un list1
Código:
Option Explicit
Dim MyArr() As Long
'wndclass_desked_gsk
'IDEOwner
Private Sub Form_Load()
    Dim i As Long
   
    MyArr = fEnumWindows
   
    For i = 0 To UBound(MyArr) - 1
        List1.AddItem GetWinText(MyArr(i))
    Next
End Sub

Private Sub List1_Click()
    Picture1.Cls
    PrintWindow MyArr(List1.ListIndex), Picture1.hDC, 0
    Me.Caption = GetWinClassName(MyArr(List1.ListIndex))
End Sub

Creo que deberia utlizar GetWindowThreadProcessId pero no encotre forma de hacerlo.

Saludos



En línea

LeandroA
Moderador
***
Desconectado Desconectado

Mensajes: 760


www.leandroascierto.com


Ver Perfil WWW
Re: Listar Ventanas, problemas con IDEOwner
« Respuesta #1 en: 12 Mayo 2009, 08:38 am »

Solucionado

es con GetLastActivePopup

Saludos


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Problemas de ventanas..
Windows
Jenag 2 1,687 Último mensaje 12 Diciembre 2012, 01:00 am
por dato000
Problemas con ventanas
Windows
DonnieDarko2 4 1,925 Último mensaje 30 Enero 2013, 17:30 pm
por DonnieDarko2
Ayuda con funcion listar ventanas en Array
Programación Visual Basic
| SMT | 3 2,354 Último mensaje 11 Agosto 2013, 16:25 pm
por Dessa
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines