Consulta sobre Handle, no me detecta una ventana abierta

123 views
Skip to first unread message

juan.nav...@gmail.com

unread,
Feb 22, 2022, 3:20:21 PM2/22/22
to Comunidad de Visual Foxpro en Español
Buen dia, estoy tratando de obtener el handle de las ventanas abiertas para poder mostrar de manera maximizada 2 de ellas, primero una y luego la otra, e ir alternando cada cierto tiempo.
Encontre un poco de codigo que esta ayudando, donde recorre las ventanas abiertas y las mete a un cursor.
El detalle es que al revisar el cursor no me lee el handle de todas las ventanas, incluso la calculadora abierta no me lo lee, pero otras si, como la de visual foxpro o carpetas abiertas.
¿A que se puede deber?

este es la seccion de codigo donde hace el recorrido:

lhWnd = GetDesktopWindow()
lhWnd = GetWindow(lhWnd, GW_CHILD)
DO WHILE lhWnd > 0
  m.WindTitle = GetTitle(lhWnd)
  *IF NOT EMPTY(m.WindTitle)
    m.hwnd     = lhWnd
    m.Style = GetWindowLong(lhWnd, GWL_STYLE)
    m.hex     = TRANSFORM(m.Style, ";@0")
    m.isiconic = IIF(IsIconic(lhWnd)=0,.F.,.T.)
    IF  BITAND(m.Style, WS_VISIBLE) > 0 ;
        AND BITAND(m.Style, WS_POPUP) = 0
      INSERT INTO crsWindows FROM MEMVAR
    ENDIF
 * ENDIF
  lhWnd = GetWindow(lhWnd, GW_HWNDNEXT )
ENDDO

Zarlu

unread,
Feb 22, 2022, 3:45:31 PM2/22/22
to Comunidad de Visual Foxpro en Español
Buenas tardes Juan!

A ver si éste te sirve:

pCursor=SYS(2015)
*** Cursor para datos
CREATE CURSOR (pCursor) (ctitulo C(100),chwnd i)
*** Constantes
#Define GW_HWNDFIRST        0
#Define GW_HWNDNEXT                2
#Define GW_OWNER                4
#Define GW_CHILD                5
*** Declaraciones de la funciones del API
DECLARE Integer GetDesktopWindow IN WIN32API
DECLARE Integer GetWindow IN WIN32API Integer nHwnd,Integer nCmd
DECLARE Integer IsWindowVisible IN WIN32API Integer  nWnd
DECLARE Integer GetWindowText IN WIN32API Integer nHwnd,String @cString,Integer nMaxCount
DECLARE Integer GetWindowTextLength IN WIN32API Integer nWnd
*** Variables
PRIVATE nHwnd,nInitHwnd,nCurrWnd,nLength,cTmp
*** Handle del DeskTop
nHwnd = GetDesktopWindow()
nInitHwnd = GetWindow( nHwnd, GW_CHILD )
*** Primera ventana
nCurrWnd = GetWindow(nInitHwnd,GW_HWNDFIRST )
*** Recorrer todas las ventanas
DO WHILE nCurrWnd # 0
                *** Sólo ventanas visible
                IF IsWindowVisible(nCurrWnd)=1        
                        *** Tamaño del título
                        nLength=GetWindowTextLength(nCurrWnd)
                        IF nLength > 0
                                *** Obtener el título
                    cTmp=REPLICATE( CHR(0), nLength+1 )
                    =GetWindowText(nCurrWnd,@cTmp,nLength + 1 )
                                INSERT INTO (pCursor) values(SUBSTR(cTmp,1,nLength),nCurrWnd)
                        Endif        
                ENDIF
        *** Siguiente ventana
        nCurrWnd = GetWindow( nCurrWnd,GW_HWNDNEXT )
ENDDO
Browse

Suerte
zarlu
Chetumal, Quintana Roo

isaias mendez cabezas

unread,
Feb 23, 2022, 11:22:34 AM2/23/22
to publice...@googlegroups.com
Alguien tiene ya base de datos armado de laboratorio clínico? Me podría vender o pasármelo estaba haciendo en acceso pero me falta hacer orden de la oratorio y eso me falta

--
Blog de la Comunidad Visual FoxPro en Español: http://comunidadvfp.blogspot.com
---
Has recibido este mensaje porque estás suscrito al grupo "Comunidad de Visual Foxpro en Español" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a publicesvfoxp...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/publicesvfoxpro/07d07d5a-771f-4dff-98dc-19bf74efc045n%40googlegroups.com.

Zarlu

unread,
Feb 23, 2022, 11:26:27 AM2/23/22
to Comunidad de Visual Foxpro en Español
Buenos días keyimc1012 !

Te sugiero abrir un hilo de nuevo tema!
Se perderá tu solicitud bajo éste título

Suerte
zarlu
Chetumal, Quintana Roo, México

William Jara

unread,
Oct 23, 2025, 4:24:16 PM (13 days ago) Oct 23
to Comunidad de Visual Foxpro en Español
Muy buen aporte
Reply all
Reply to author
Forward
0 new messages