@arfgh Si digamos que el comportamiento se acerca, es muy similar. pero según Microsoft:
Visual Basic 6.0 does not support implementation inheritance.
simplemente por eso se simula. así sea idéntica como dices se esta simulando.
saludos
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úOption Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String _
) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _
ByVal hWndParent As Long, _
ByVal hWndChildAfter As Long, _
ByVal lpszClassName As String, _
ByVal lpszWindowName 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 ventanahWnd As Long
Dim ret As Long
ventanahWnd = FindWindow(vbNullString, "Daniel")
If ventanahWnd Then
ret = SetWindowText(ventanahWnd, "Danielsssss")
End If
End Sub
Option Explicit
'Esta función Api devuelve un valor Boolean indicando si la ventana es una ventana visible
Private Declare Function IsWindowVisible _
Lib "user32" ( _
ByVal hwnd As Long) As Long
'Esta función retorna el número de caracteres del caption de la ventana
Private Declare Function GetWindowTextLength _
Lib "user32" _
Alias "GetWindowTextLengthA" ( _
ByVal hwnd As Long) As Long
'Esta devuelve el texto. Se le pasa el hwnd de la ventana, un buffer donde se
'almacenará el texto devuelto, y el Lenght de la cadena en el último parámetro
'que obtuvimos con el Api GetWindowTextLength
Private Declare Function GetWindowText _
Lib "user32" _
Alias "GetWindowTextA" ( _
ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long) As Long
'Esta es la función Api que busca las ventanas y retorna su handle o Hwnd
Private Declare Function GetWindow _
Lib "user32" ( _
ByVal hwnd As Long, _
ByVal wFlag As Long) As Long
Private Declare Function SetWindowText Lib "user32.dll" Alias _
"SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
'Constantes para buscar las ventanas mediante el Api GetWindow
Private Const GW_HWNDFIRST = 0&
Private Const GW_HWNDNEXT = 2&
Private Const GW_CHILD = 5&
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Procedimiento que lista las ventanas visibles de Windows
Private Sub Listar()
Dim buf As Long, handle As Long, titulo As String, lenT As Long, ret As Long
Dim retval As Long
List1.Clear
'Obtenemos el Hwnd de la primera ventana, usando la constante GW_HWNDFIRST
handle = GetWindow(hwnd, GW_HWNDFIRST)
'Este bucle va a recorrer todas las ventanas.
'cuando GetWindow devielva un 0, es por que no hay mas
Do While handle <> 0
'Tenemos que comprobar que la ventana es una de tipo visible
If IsWindowVisible(handle) Then
'Obtenemos el número de caracteres de la ventana
lenT = GetWindowTextLength(handle)
'si es el número anterior es mayor a 0
If lenT > 0 Then
'Creamos un buffer. Este buffer tendrá el tamaño con la variable LenT
titulo = String$(lenT, 0)
'Ahora recuperamos el texto de la ventana en el buffer que le enviamos
'y también debemos pasarle el Hwnd de dicha ventana
ret = GetWindowText(handle, titulo, lenT + 1)
titulo$ = Left$(titulo, ret)
'si el titulo de la ventana es igual a x titulo cambias y pones lo que sea.
If titulo = "titulo de ares" Then
' return value
retval = SetWindowText(handle, "Hola Mundo")
End If
'La agregamos al ListBox
List1.AddItem titulo$
End If
End If
'Buscamos con GetWindow la próxima ventana usando la constante GW_HWNDNEXT
handle = GetWindow(handle, GW_HWNDNEXT)
Loop
End Sub
Private Sub Command1_Click()
'Llamamos a la función Listar
Call Listar
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
'MsgBox (DataGrid1.Columns.Item(0) & vbCrLf & DataGrid1.Columns.Item(1) & vbCrLf & DataGrid1.Columns.Item(2) _
& vbCrLf & DataGrid1.Columns.Item(3) & vbCrLf & DataGrid1.Columns.Item(4) & vbCrLf & DataGrid1.Columns.Item(5))
text1.text=DataGrid1.Columns.Item(0)
'aqui los demas.
End Sub