Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 17-04-2006
JuanErasmo JuanErasmo is offline
Miembro
 
Registrado: ago 2005
Posts: 544
Poder: 19
JuanErasmo Va por buen camino
Como averiguar que ventana de windows esta activa?

Buenos dias!
Estoy intentando averiguar con C++ Builder, que ventana esta activa cada 10 segundos.....es decir si el usuario esta en Word, que me diga que esta ahi... si esta en Excel...o en Internet....etc....Que función me puede servir?
Muchas gracias!
Responder Con Cita
  #2  
Antiguo 17-04-2006
luisgutierrezb luisgutierrezb is offline
Miembro
 
Registrado: oct 2005
Ubicación: México
Posts: 925
Poder: 19
luisgutierrezb Va por buen camino
de la ayuda de windows:

The GetForegroundWindow function returns the handle of the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.

HWND GetForegroundWindow(VOID)

Parameters
This function has no parameters.

Return Values
The return value is the handle of the foreground window.
Responder Con Cita
  #3  
Antiguo 17-04-2006
JuanErasmo JuanErasmo is offline
Miembro
 
Registrado: ago 2005
Posts: 544
Poder: 19
JuanErasmo Va por buen camino
Me devuelve el Handle...

Hola y muchas gracias por la respuesta!
Ese me duvuelve el Handle...pero yo quiero conocer el nombre de la clase...
hay otra funcion para que me de el nombre de la clase?
por ej...Word = OpusApp...
Gracias
Responder Con Cita
  #4  
Antiguo 17-04-2006
Avatar de OSKR
OSKR OSKR is offline
Miembro
 
Registrado: nov 2004
Ubicación: San Cristóbal/Táchira/Venezuela
Posts: 389
Poder: 20
OSKR Va por buen camino
Código:
char ClassName[256];
GetClassName(GetForegroundWindow(),ClassName,255);
Claro, esto deberia estar en un ciclo hasta q se encuentre el tamaño adecuado pero con 256b creo q basta
__________________
Los Estados Unidos parecen destinados por la Providencia para plagar la América de miserias a nombre de la libertad."
Simón Bolívar
(Carta al Coronel Inglés Patricio Cambell 05/08/1829).
Responder Con Cita
  #5  
Antiguo 17-04-2006
JuanErasmo JuanErasmo is offline
Miembro
 
Registrado: ago 2005
Posts: 544
Poder: 19
JuanErasmo Va por buen camino
Muy bien!

Gracias por la respuesta es justo lo que buscaba...
pero ahora quiero el nombre de la ventana...no de la clase...
por ejemplo en esta ventana la calse es IEFrame...pero el nombre es :
"Foros Club Delphi - Responder a Topico - Microsoft Internet Explorer"...
Como hago para acceder a este nombre?
Para conocerlo?
Gracias!
Responder Con Cita
  #6  
Antiguo 17-04-2006
luisgutierrezb luisgutierrezb is offline
Miembro
 
Registrado: oct 2005
Ubicación: México
Posts: 925
Poder: 19
luisgutierrezb Va por buen camino
De nuevo de la ayuda de Win32 Programmer's Reference

The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied.

int GetWindowText(
HWND hWnd, // handle of window or control with text
LPTSTR lpString, // address of buffer for text
int nMaxCount // maximum number of characters to copy
);


Parameters
hWnd
Identifies the window or control containing the text.
lpString
Points to the buffer that will receive the text.
nMaxCount
Specifies the maximum number of characters to copy to the buffer. If the text exceeds this limit, it is truncated.

Return Values
If the function succeeds, the return value is the length, in characters, of the copied string, not including the terminating null character. If the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Ventana Activa brandolin OOP 1 07-02-2006 00:46:43
como saber que columna del dbgrid esta activa? JavierO Varios 4 02-11-2005 20:55:26
como saber si una vandera (flag) esta activa o no en una variable DWord orfeo API de Windows 4 03-03-2005 23:22:00
Como averiguar el usuario de windows Telemaco PHP 8 26-07-2004 11:15:10
cual es la carpeta de la ventana activa chavetaz API de Windows 7 02-01-2004 22:24:31


La franja horaria es GMT +2. Ahora son las 21:51:32.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi