I like the idea of a Delphi Code Insight window (a custom list on a form without borders basically) where you can click outside the form and it will automatically close it.
My first thought was to call SetCapture / ReleaseCapture in FormCreate and FormDestroy respectively. I set the title of the form in X / Y to FormMouseMove, but it does not update the coordinates outside the form.
If I call SetCapture / ReleaseCapture from MouseDown and MouseUp, it will update the coordinates as expected, which proves that the concept really works.
I have tried other things, for example. send WM_USER to the OnShow event and call SetCapture from there, but it still does not update the coordinates. Then I tried the TApplicationEvents (OnMessage) component, but that does not work either.
I already read several articles, but could not find what I was looking for. Some articles are called SetCapture from MouseMove, but this does not work when the mouse cursor starts outside the form. Hmm ...
The next step is to use WindowsHook, but where I left off. I know how to implement it, but it seems to me that I am missing something really obvious here. There should be an easier way to do this.
Any ideas? :)
Cheers, Jarno
source share