Re: Detecting Window



Fufi wrote:
Hi, someone know for a good component or code that
can I use to detect global Windows messages
about windows are opened/closed.

I dont need to detect what window was opened,
but just that some window was opened....

Install a system-wide CBT hook (See Google). The Platform SDK has this to say about CBT hooks:


"The CBTProc hook procedure is an application-defined or library-defined callback function used with the SetWindowsHookEx function. The system calls this function before activating, creating, destroying, minimizing, maximizing, moving, or sizing a window; before completing a system command; before removing a mouse or keyboard event from the system message queue; before setting the keyboard focus; or before synchronizing with the system message queue. A computer-based training (CBT) application uses this hook procedure to receive useful notifications from the system."

Cheers,
Nicholas Sherlock
.



Relevant Pages

  • Re: Implement a SendMessage behaviour
    ... I know the call stack of a thread can't be empty but it was the simpliest way I found to explain the feature I needed. ... I meant I need as less as possible results of user actions in call stack of the thread that will run the new action. ... As soon as the next action is started, that's not a problem if the windows message queue receive some message as they will wait my current action ends to be proceed ... not in any way guarantee that by the time the message sent is actually processed that the window message queue is empty. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Detecting Window
    ... >> but just that some window was opened.... ... > Install a system-wide CBT hook. ... before removing a mouse or keyboard event from the system ... > synchronizing with the system message queue. ...
    (alt.comp.lang.borland-delphi)
  • Re: How to get around new limitations on SetForegroundWindow()?
    ... > message queue for each graphical user interface thread. ... of the foreground window and of the window I want to bring forward. ... So I attach the threads of the two ... calling thread has to be the one that attaches. ...
    (microsoft.public.win32.programmer.ui)
  • Re: Active component on form1 after closing form2
    ... EditX on Form1 responds to the message that causes it to execute its 'OnExit' ... Each thread has a single message queue. ... Having one window open does not preclude other windows in the same thread from receiving and processing messages. ... It's the fact that the message you post gets handled *after* all the focus-changing messages have already gone through. ...
    (comp.lang.pascal.delphi.misc)
  • Re: PeekMessage not working as desired!
    ... the normal way is to start a worker thread which does the long ... It is inconsistent with keeping the message queue window ... a timer instead of another thread is much easier to ...
    (microsoft.public.vc.mfc)