This is the first time I have used the SetWindowsHookEx function - I have
used Windows messages before so I assume there is some similarity to that.
However, having read the MSDN info I am still a little confused as to how I
should use it.

Recalling that I want my application to respond to the movement or resizing
of another application  running on the desktop this is what I think I must
do....

Hook into the thread in which my target application is running. To do this I
need to use FindWindow (I know there will only be one instance of the App so
should be unique) and using the handle supplied call
GetWindowThreadProcessID to establish the threadID.  I can then use
SetWindowsHookEx with the WH_CALLWNDPROCRET parameter (as I want to
establish when the user has repositioned the application I am monitoring) to
hook into the any resizing or positioning of the application running in this
thread. 

I can then use GetWindowsRect to establish the boundaries of the
application.

Is this correct?

JohnB

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Rob Kennedy
Sent: 13 February 2008 00:04
To: Borland's Delphi Discussion List
Subject: Re: How to find the position on the screen of an application

John Barrat wrote:
> Cancel that request - I have found the relevant messages - 
> WM_WINDOWPOSCHANGED and WM_SIZE

Those messages are only sent to the window that moved. They're not sent to
your program for any windows but your program's. You can't use them to be
notified of the movement of another program's windows. To do that, you need
to install a hook, in which case those messages will get passed to the hook
function as well as the original target window.

-- 
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to