[SOLUCIONADO] Mostrar Nombre De La Ventana Activa

Iniciado por sancakoky1, Agosto 08, 2011, 01:47:15 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Agosto 08, 2011, 01:47:15 PM Ultima modificación: Febrero 14, 2015, 09:13:16 AM por Expermicid
Estoy intentando en You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login que me saque un mensaje con la ventana que tengo activa pero no tengo mucha idea asi que he cogido a San Google y me he puesto a leer y leer pero me quedan muchas dudas asi pues escribo para ver si me hechais una mano.
Creo un timer y dentro de ese evento declaro 3 variables:
Dim numerodeproceso As Long
Dim longituddeltexto As Long
Dim textodelaventana As String
Almaceno con 3 funciones que he visto en google para ver si consigo el texto de la ventana activa:
numerodeproceso = GetForegroundWindow
longituddeltexto = GetWindowTextLength(numerodeproceso) + 1
textodelaventana = Space(longituddeltexto)

Me casca en la funcion space al recoger el long.

Alguien me ayuda en You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login paso a paso a mostrar en un msg(ventanaactiva).

Hola brother, estube intentando lo mismo, pero te recomendaria hacerlo con los procesos, pero tubieras que poner un Timer que haga un bucle cada 5 o 10 segundos, cualquier duda enviame un MP
Hazlo todo tan simple como sea posible, pero no más simple. Albert Einstein

Código: text
Option Explicit
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, _
             ByVal lpString As String, ByVal cch As Long) As Long
Private Sub Form_Click()
    Dim LongitudNomVentana As Long, NomVentana As String, Manejador As String
    NomVentana = Space$(255)
    Manejador = GetActiveWindow()
    LongitudNomVentana = GetWindowText(GetActiveWindow(), NomVentana, 255)
    MsgBox Left(NomVentana, LongitudNomVentana)
End Sub