Título: Cambiar el Nombre de una Ventana en VB Publicado por: Hendrix en 2 Mayo 2006, 21:52 pm Weno, supongamos que quiero cambiar el nombre de una ventana actica del Mozilla en VB.....existe alfuna API para ahcere esto???
Salu2 Hendrix Título: Re: Cambiar el Nombre de una Ventana en VB Publicado por: .:CorTeX:. en 3 Mayo 2006, 02:02 am Mira estas Apis:
Código: Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long Pero primero, tienes que obtener el Handle de la Ventana a modificar, para hacer esto, usa esta Apis: Código: Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Long Título: Re: Cambiar el Nombre de una Ventana en VB Publicado por: Robokop en 3 Mayo 2006, 02:57 am Esta buena la idea de cambiar el nombre ala ventana.
Te ayudo con la api de setwindowtext Código: 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 Sub Form_Activate() Dim MyStr As String MyStr = String(100, Chr$(0)) GetWindowText Me.hwnd, MyStr, 100 MyStr = Left$(MyStr, InStr(MyStr, Chr$(0)) - 1) MyStr = MyStr + MyStr + MyStr SetWindowText Me.hwnd, MyStr End Sub Título: Re: Cambiar el Nombre de una Ventana en VB Publicado por: NYlOn en 3 Mayo 2006, 23:17 pm Suponiendo que la ventana que queremos cambiar se llama MSN Messenger (el msn...) podrias usar este
Código: Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long Private Sub Command1_Click() Dim Ret As Long Ret = FindWindow(vbNullString, "MSN Messenger") SetWindowText Ret, "Prueba" End Sub Espero que te sirva, saludos. (esta provado).- Título: Re: Cambiar el Nombre de una Ventana en VB Publicado por: Hendrix en 3 Mayo 2006, 23:23 pm Me va de P.M.... ;) ;) ;)
Salu2 y Gracias ;) ;) Título: Re: Cambiar el Nombre de una Ventana en VB Publicado por: Hendrix en 3 Mayo 2006, 23:34 pm Una ultima kosa...komo kapturo el nombre de la ventana activa???
Tengo un kode...pero para lso nombre que kontienen guieon ( - ) no funciona.... :-\ :-\ :-\ Salu2 y gracias... ;) ;) Título: Re: Cambiar el Nombre de una Ventana en VB Publicado por: NYlOn en 4 Mayo 2006, 03:42 am Código: Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private sub Command1_Click () Dim Ret As Long Dim Titulo As String Titulo = String(100, Chr(0)) Ret = GetForegroundWindow GetWindowText Ret, Titulo, 100 MsgBox Titulo end sub Saludos.- |