FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
|||
|
|||
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! |
#2
|
|||
|
|||
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. |
#3
|
|||
|
|||
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 |
#4
|
||||
|
||||
Código:
char ClassName[256]; GetClassName(GetForegroundWindow(),ClassName,255);
__________________
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). |
#5
|
|||
|
|||
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! |
#6
|
|||
|
|||
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. |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Ventana Activa | brandolin | OOP | 1 | 06-02-2006 23:46:43 |
como saber que columna del dbgrid esta activa? | JavierO | Varios | 4 | 02-11-2005 19:55:26 |
como saber si una vandera (flag) esta activa o no en una variable DWord | orfeo | API de Windows | 4 | 03-03-2005 22:22:00 |
Como averiguar el usuario de windows | Telemaco | PHP | 8 | 26-07-2004 10:15:10 |
cual es la carpeta de la ventana activa | chavetaz | API de Windows | 7 | 02-01-2004 21:24:31 |
|