15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


WM_LBTNDOWN and WM_NCHITTEST Problem

Guess who.... -- guess@ingress1.ingress.com
Thursday, May 30, 1996

     Windows NT 3.51  -  MFC 4.1

   I originally wrote a program using Windows 95. One of the classes based
on CStatic was starting a drag & drop operation on WM_LBUTTONDOWN (not
sure if I spelled that right). After being fed up with Win95 crashes, I
moved up to Windows NT 3.51 and now none of those events arive.

   While using Spy++, the only mouse events that that window is getting is
WM_NCHITTEST, for both mouse movements and Button clicks.

Can somebody please give me any idea on fixing this.

Timur




Dean McCrory -- deanm@microsoft.com
Sunday, June 02, 1996

[Mini-digest: 3 responses]

Guess,

This is because NT returns HTNOWHERE from WM_NCHITTEST for static
controls.  That keeps the mouse messages from happening.  If you want
'em, you should probably return HTCLIENT from WM_NCHITTEST in your
subclass.

// Dean

-----From: Christophe Nasarre 

As far as I know, CStatic is wrapping a STATIC window. Since this particular
class returns HTTRANSPARENT to WM_NCHITTEST message, it is clear that it
will never get a button mouse message : its parent will get it.

So, if you want your CStatic to get WM_LBUTTONDOWN message, you have to also
handle WM_NCHITTEST message and return something like HTCLIENT for example 
--> you will get mouse button messages.


Good luck

   -- a poor lonely frenchie --



-----From: Wolfgang Loch 

So far I understand you, you have derived the CYourStatic class from
CStatic and subclassed the Object by means of SubclassDlgItem or
DDX_Control.
In this case you should handle the WM_LBUTTONDOWN - message in the
CYourStatic class, not in the dialog box.

Wolfgang




| Вернуться в корень Архива |