Weno, como puedo saber, a partir de un trozo del titulo, kual es el titulo kompleto????
Por ejemplo, Supongamos que abro el Bloc de notas, y el titulo de la ventana es esto:
Sin titulo - Bloc de notas
Supongamos que yo quiero, a partir de Bloc de notas, que me diga todo el titulo de la ventana (es decir, Sin titulo - Bloc de notas).
Komo puedo hacer esto????
Weno, Gracias
Salu2
si el so que yo pienso que quieres saber seria haci:
text1.text = form1.caption
y en el text te da el nombre de la ventana.
o si quieres cambiar desde el programa el nombre de la ventana has:
form1.caption = "Lo que quieras" 'tambien puedes usar controles como los text
Cita de: Punk-rock en 21 Marzo 2006, 18:13 PM
Weno, como puedo saber, a partir de un trozo del titulo, kual es el titulo kompleto????
Por ejemplo, Supongamos que abro el Bloc de notas, y el titulo de la ventana es esto:
Sin titulo - Bloc de notas
Supongamos que yo quiero, a partir de Bloc de notas, que me diga todo el titulo de la ventana (es decir, Sin titulo - Bloc de notas).
Komo puedo hacer esto????
Weno, Gracias
Salu2
Podes listar todas las ventanas y despues hacer un bucle buscando una parte de la ventana con IF, x ejemplo:
If Right(Ventana, 5) = "notas" then
msgbox Ventana
End if
Lo que no se hacer es listar las ventanas.... :-\ :-\ :-\
Gracias por kontestar.... ;) ;) ;)
Salu2
Hendrix
Copio el modulo sacado del proyecto de LeandroA (http://foro.elhacker.net/index.php/topic,113051.msg521902.html#msg521902)
Option Explicit
Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindow Lib "User32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal wIndx As Long) As Long
Declare Function GetWindowTextLength Lib "User32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const MAX_PATH As Integer = 260
Const GWL_STYLE = (-16)
Const Win_VISIBLE = &H10000000
Const Win_BORDER = &H800000
Const SC_CLOSE = &HF060&
Const WM_SYSCOMMAND = &H112
Dim ListaProcesos As Object
Dim ObjetoWMI As Object
Dim ProcesoACerrar As Object
Public Sub EnumTopWindows()
Dim IsTask As Long, hwCurr As Long, intLen As Long, strTitle As String
IsTask = Win_VISIBLE Or Win_BORDER
hwCurr = GetWindow(Form1.hWnd, 0)
Do While hwCurr
If hwCurr <> Form1.hWnd And (GetWindowLong(hwCurr, GWL_STYLE) And IsTask) = IsTask Then
intLen = GetWindowTextLength(hwCurr) + 1
strTitle = Space$(intLen)
intLen = GetWindowText(hwCurr, strTitle, intLen)
If intLen > 0 Then
Form1.List1.AddItem strTitle
End If
End If
hwCurr = GetWindow(hwCurr, 2)
Loop
End Sub
Public Sub CloseApp(ByVal Titulo As String, Optional ClassName As String)
Call SendMessage(FindWindow(ClassName, Titulo), WM_SYSCOMMAND, SC_CLOSE, ByVal 0&)
End Sub
Public Sub Procesos()
Set ObjetoWMI = GetObject("winmgmts:")
If IsNull(ObjetoWMI) = False Then
Set ListaProcesos = ObjetoWMI.InstancesOf("win32_process")
For Each ProcesoACerrar In ListaProcesos
Form1.List2.AddItem LCase$(ProcesoACerrar.Name)
Next
End If
Set ListaProcesos = Nothing
Set ObjetoWMI = Nothing
End Sub
Despues para usarlo es facil:
Tenes que tener 2 lstbox (List1 y List2) y despues desde cualquier evento llamas a
EnumTopWindows
Procesos
Saludos.-
Muchas gracias, ya estoy cerka de lo que quiero....
Ahora komo se hacria para que me diga si hay alguna palabra del List1 que kontenga la palabra notas (por ejemplo)????
Muchas gracias NYlon!!!!! ;) ;) ;)
Salu2
Hendrix
For i = 0 to list1.listcount
if right(list1.list(i), 5) = "notas" then
msgbox list1.list(i)
end if
next i
Asi tendria que funcionar si no me equivoco.
Saludos.-
oka, me imagino que si, jejejeje gracias por el kode....
Salu2
Hendrix