¿Hay alguna forma de "enlazar" a los datos de la ventana para todas las ventanas abiertas?

I've written some interop code that utilizes user32.dll to enumerate the windows and add them to a List. WindowData is a local INotifyPropertyChanged class that stores window hWnd, title, Position, Size, executable path, app icon, etc.

Is there a way that I could effectively "bind" to changes of the window title, position, size, etc? I wouldn't want to have to use a DispatcherTimer to update the information every second. I'd prefer it if I could use a simple event handler or callback or something.

¿Alguien tiene alguna idea?

preguntado el 08 de enero de 11 a las 22:01

1 Respuestas

To efficiently keep track of the windowing data for all windows without polling you have to register for notification of window creation or deletion and then hook all their message queues and process messages that affect the windowing data you are trying to track. Unfortunately, this is quite a substantial task. If you want a head start, you can take a look at how Spy++ is implemented and so something similar. Here's an article:

After looking at that you might was to re-consider just polling every so often and carefully update only the changed data in the ObservableCollection.

Respondido el 09 de enero de 11 a las 03:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.