🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #2962

Re: X-Windows like mouse/focus behavior (here's how)

#2962
From: Tom J Parry
Date: Sun, 20 Dec 1992 00:49
20 lines
1584 bytes
Larry Salomon Jr. (os2man@panix.com) wrote:
> For those interested, I've seen quite a few requests for this behavior.
> Although I haven't tried the below, it should work; no guarantees, however.

> The strategy here is to install a system-wide HK_INPUT hook which follows
> the WM_MOUSEMOVE messages.  You can easily call WinWindowFromPoint() to
> obtain the window handle under the mouse, follow the parent chain until
> you reach the top-level window, and call WinSetFocus() to give it the focus.

You don't need to follow the parent chain, you can do
WinWindowFromPoint(HWND_DESKTOP, &ptl, FALSE). The FALSE means don't look
at children windows so the window returned will be a child of HWND_DESKTOP.
If you do decide to trace backwards for some reason be careful not to
compare anything to HWND_DESKTOP. HWND_DESKTOP is a constant (0 or 1)
whereas a window function will return the handle of the desktop window
(0x201383 or something similar on mine).

-- 
Tom J Parry.
Your reality is a figment of my imagination.
Technical Details
Message-ID: <1992Dec20.004902.25186@monu6.cc.monash.edu.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!yoyo.cc.monash.edu.au!parry
References: <1992Dec16.145017.23804@panix.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!yoyo.cc.monash.edu.au!parry
From: parry@yoyo.cc.monash.edu.au (Tom J Parry)
Subject: Re: X-Windows like mouse/focus behavior (here's how)
Message-ID: <1992Dec20.004902.25186@monu6.cc.monash.edu.au>
Originator: parry@yoyo.cc.monash.edu.au
Sender: news@monu6.cc.monash.edu.au (Usenet system)
Organization: Monash University, Melb., Australia.
References: <1992Dec16.145017.23804@panix.com>
Date: Sun, 20 Dec 1992 00:49:02 GMT
Lines: 20