次のように解決しました。
まず、当たり判定を次のように改変します。
c++
1 struct MYHITTEST
2 {
3 HWND hParent;
4 HWND hCandidate;
5 HWND hLast;
6 POINT pt;
7 };
8
9 static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
10 {
11 MYHITTEST *pmht = (MYHITTEST *)lParam;
12 RECT rc;
13 GetWindowRect(hwnd, &rc);
14 if (PtInRect(&rc, pmht->pt))
15 {
16 // NOTE: EnumChildWindows scans not only children but descendants.
17 if (MRadCtrl *pCtrl = MRadCtrl::GetRadCtrl(hwnd))
18 {
19 if (pCtrl->m_bTopCtrl)
20 {
21 pmht->hLast = hwnd;
22 if (!IsGroupBox(hwnd))
23 {
24 pmht->hCandidate = hwnd;
25 }
26 }
27 }
28 }
29 return TRUE;
30 }
31
32 UINT OnNCHitTest(HWND hwnd, int x, int y)
33 {
34 if (m_bTopCtrl)
35 {
36 RECT rc;
37 GetWindowRect(hwnd, &rc);
38
39 POINT pt = { x, y };
40 if (m_hwndRubberBand && PtInRect(&rc, pt))
41 return HTCAPTION;
42
43 MYHITTEST mht;
44 mht.hParent = GetParent(hwnd);
45 mht.hCandidate = NULL;
46 mht.hLast = NULL;
47 mht.pt = pt;
48 EnumChildWindows(mht.hParent, EnumChildProc, (LPARAM)&mht);
49
50 if (mht.hCandidate == hwnd ||
51 (!mht.hCandidate && mht.hLast == hwnd))
52 {
53 return HTCAPTION;
54 }
55 }
56 return HTTRANSPARENT;
57 }
次に、MRubberBand::CreateDxの呼び出しの直後に、次のようなコードを追記します。
c++
1 if (!MRadCtrl::IsGroupBox(hwnd))
2 {
3 SetWindowPosDx(hwnd, NULL, NULL, HWND_BOTTOM);
4 }
これで上下関係はバッチリいけました。皆様、ありがとうございました。