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

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Caption De Un Label
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Caption De Un Label  (Leído 1,878 veces)
ZiroViI

Desconectado Desconectado

Mensajes: 15



Ver Perfil
Caption De Un Label
« en: 23 Octubre 2012, 16:05 pm »

Buenas Gente!!
   Tengo una Duda.. es Posible Capturar el Label.caption de una aplicacion creada en vb6 ...??

yo uso la api FindWindowEx para Enviar Pulsaciones a button y otra coass...
pero no se como acceder con lo labels..

Muchas Gracias!!


En línea

seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: Caption De Un Label
« Respuesta #1 en: 23 Octubre 2012, 17:27 pm »

los labels son controles llamados "windowless" no son ventanas, solo se pintan, y si tratas de enumerarlos con alguna api tampoco lo hace ya que no tienen Hwnd.

pero me acuerdo que hace mucho habia publicado algo donde se podian ver, no me aucerdo, si lo encuentro lo pongo.

PD: aca esta:

Handle de un Label

saludos.


« Última modificación: 23 Octubre 2012, 17:30 pm por seba123neo » En línea

ZiroViI

Desconectado Desconectado

Mensajes: 15



Ver Perfil
Re: Caption De Un Label
« Respuesta #2 en: 23 Octubre 2012, 21:23 pm »

Muchas GrAcias!!

no lo pude hacer Andar :P y entiendo Nada de ese codigo xD

Me Tira Error Despues de esta Liena

... va no tira erro en esa linea... perro hast ahi Es donde Sale El MsgBox... si lo pongo mas abajo Salta El error Run time...
Código:
Public Sub GetFormLabels(hwnd As Long)
    Dim sClass As String
    Dim lRet As Long
    Dim pid As Long
    Dim lFormCaptionHeapAddress As Long
 
    Dim lpMem As Long
    Dim lLenMBI As Long
    Dim lBytesRead As Long
    Dim mbi As MEMORY_BASIC_INFORMATION
 
    'Make sure we are working with a VB Form hWnd
    sClass = Space(256)
    lRet = GetClassName(hwnd, sClass, 255)
    sClass = Left(sClass, lRet)
    If Not sClass = "ThunderRT6FormDC" Then
        MsgBox "Solo funciona compilado a .exe", vbInformation
        Exit Sub
    End If
 
    'Now get the internal heap address of the form caption.  All that we need can be found in this heap (hopefully!)
    'This is done with a little undocumented SendMessage magic
    lFormCaptionHeapAddress = SendMessage(hwnd, VBM_WINDOWTITLEADDR, ByVal 0&, ByVal 0&)
 
    'Get a handle on the process with required access
    lRet = GetWindowThreadProcessId(hwnd, pid)
    If pid = 0 Then
        MsgBox "No se pudo obtener el PID", vbExclamation
        Exit Sub
    End If
    hProcess = OpenProcess(PROCESS_READ_WRITE_QUERY, False, pid)
 
    'Get the Heap at the caption point
    lLenMBI = Len(mbi)
    lpMem = lFormCaptionHeapAddress
    mbi.AllocationBase = lpMem
    mbi.BaseAddress = lpMem
    lRet = VirtualQueryEx(hProcess, ByVal lpMem, mbi, lLenMBI)
    If lRet <> lLenMBI Then GoTo Finished
 
    'Now go back and get the entire heap
    lBaseAddress = mbi.AllocationBase
    lpMem = lBaseAddress
    mbi.BaseAddress = lBaseAddress
    mbi.RegionSize = 0
    lRet = VirtualQueryEx(hProcess, ByVal lpMem, mbi, lLenMBI)
    If lRet <> lLenMBI Then GoTo Finished

    'A couple of sanity checks, just to be safe
    If Not ((mbi.lType = MEM_PRIVATE) And (mbi.State = MEM_COMMIT) And mbi.RegionSize > 0) Then
        MsgBox "Unexpected Heap Type, State, or Size."
        GoTo Finished
    End If
 
     'Allocate a buffer and read it in
    ReDim abBuffer(mbi.AllocationBase To mbi.AllocationBase + mbi.RegionSize - 1)
    ReadProcessMemory hProcess, ByVal mbi.BaseAddress, abBuffer(LBound(abBuffer)), mbi.RegionSize, lBytesRead

    'So far, so good.  Things get messy from here.  We have to
    'do some manual parsing of the buffer to get what we are after.  To
    'make things easier, I'll will get every label on every form in the
    'exe.  Otherwise, you will need to first find the form that is
    'reference the caption.  Then find every label between it and the next
    'form.
  
MSGBOX " HASTA AK LEE "
  
Código:
  Dim iCnt As Integer
    Dim al() As Long
  
    'Print all of the label captions
    If EnumVBObjectPtrs("VB.Label", 44, al) > 0 Then
        For iCnt = LBound(al) To UBound(al)
             MsgBox "Hit at: " & al(iCnt) + 44 & vbNewLine & "Object At: " & al(iCnt) & vbNewLine & "Texto Del Label: " & GetLabelCaption(al(iCnt)) & vbNewLine & "Nombre del Label: " & GetLabelName(al(iCnt)), vbInformation
        Next iCnt
    End If

Finished:
    CloseHandle hProcess
    abBuffer() = ""
End Sub


y desp tira un error...
run-time error 9 : subscript out of eange
« Última modificación: 23 Octubre 2012, 21:30 pm por ZiroViI » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Como detectar que un label cambia de caption
Programación Visual Basic
‭lipman 6 2,537 Último mensaje 22 Agosto 2007, 16:35 pm
por ‭lipman
Caption
Programación Visual Basic
Aguylera 3 1,854 Último mensaje 8 Julio 2009, 22:35 pm
por Aguylera
Obtener caption del click ???
Programación Visual Basic
x64core 7 3,933 Último mensaje 30 Julio 2011, 08:46 am
por x64core
Cambiar caption de un programa
Programación Visual Basic
Hardbook 7 3,460 Último mensaje 1 Agosto 2013, 00:24 am
por Danyfirex
Cambia Caption...
Programación Visual Basic
TheJucas21 6 2,622 Último mensaje 17 Junio 2014, 10:57 am
por MCKSys Argentina
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines