00074 {
00075 HWND hwndChild;
00076
PWND pwndChild;
00077
PWND pwndControl;
00078 MSG
msg;
00079 RECT rc;
00080
int cBorders;
00081
PTHREADINFO ptiCurrent =
PtiCurrent();
00082
DLGENUMDATA DlgEnumData;
00083
TL tlpwndChild;
00084
00085
CheckLock(pwnd);
00086 UserAssert(
IsWinEventNotifyDeferredOK());
00087
00088
if (
FWINABLE()) {
00089
xxxWindowEvent(EVENT_SYSTEM_CONTEXTHELPSTART, pwnd, OBJID_WINDOW,
00090 INDEXID_CONTAINER, 0);
00091 }
00092
00093
zzzSetCursor(
SYSCUR(HELP));
00094
xxxCapture(ptiCurrent, pwnd, SCREEN_CAPTURE);
00095
00096 cBorders =
GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE);
00097
00098
CopyInflateRect(&rc, &pwnd->
rcWindow, -cBorders *
SYSMET(CXBORDER), -cBorders *
SYSMET(CYBORDER));
00099
00100
while (ptiCurrent->
pq->
spwndCapture == pwnd) {
00101
if (!
xxxPeekMessage(&msg, NULL, 0, 0, PM_NOYIELD | PM_NOREMOVE)) {
00102
xxxWaitMessage();
00103
continue;
00104 }
00105
00106
if (
msg.message == WM_NCLBUTTONDOWN) {
00107
break;
00108 }
else if (
msg.message == WM_LBUTTONDOWN) {
00109
00110
00111
00112
if (!
PtInRect(&rc,
msg.pt))
00113
break;
00114
00115
00116
00117
00118 hwndChild =
xxxWindowHitTest(pwnd,
msg.pt, NULL, 0);
00119 pwndChild =
ValidateHwnd( hwndChild );
00120
ThreadLock(pwndChild, &tlpwndChild);
00121
00122
if (pwndChild &&
FIsParentDude(pwndChild))
00123 {
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 DlgEnumData.
pwndDialog = pwndChild;
00148 DlgEnumData.
pwndControl =
NULL;
00149 DlgEnumData.
ptCurHelp =
msg.pt;
00150
xxxInternalEnumWindow(pwndChild, EnumPwndDlgChildProc, (LPARAM)&DlgEnumData, BWL_ENUMCHILDREN);
00151 pwndControl = DlgEnumData.
pwndControl;
00152 }
else {
00153 pwndControl = pwndChild;
00154 }
00155
00156
00157
00158
00159
if (pwndControl == pwnd) {
00160 pwndControl =
NULL;
00161 }
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
if (!pwndControl) {
00173
if (
_GetProp(pwnd,
MAKEINTATOM(
gpsi->
atomContextHelpIdProp), TRUE))
00174 pwndControl = pwnd;
00175 }
00176
00177
if (pwndControl) {
00178
PWND pwndSend;
00179
int id;
00180
TL tlpwndSend;
00181
TL tlpwndControl;
00182
00183
ThreadLockAlways(pwndControl, &tlpwndControl);
00184
00185
zzzSetCursor(
SYSCUR(ARROW));
00186
xxxReleaseCapture();
00187
xxxRedrawTitle(pwnd, DC_BUTTONS);
00188
ClrWF(pwnd, WFHELPBUTTONDOWN);
00189
xxxGetMessage(&msg, NULL, 0, 0);
00190
00191
if (
FWINABLE()) {
00192
xxxWindowEvent(EVENT_OBJECT_STATECHANGE, pwnd, OBJID_TITLEBAR,
00193 INDEX_TITLEBAR_HELPBUTTON, FALSE);
00194
00195
xxxWindowEvent(EVENT_SYSTEM_CONTEXTHELPEND, pwnd, OBJID_WINDOW,
00196 INDEXID_CONTAINER, FALSE);
00197 }
00198
00199
00200
00201
00202
00203
00204
if (
TestwndChild(pwndControl)) {
00205
id =
PTR_TO_ID(pwndControl->
spmenu);
00206
if (
id == 0xffff) {
00207
id = -1;
00208 }
00209 }
else {
00210
id = -1;
00211 }
00212
00213
00214
00215
00216
00217
00218
00219
if (
TestWF(pwndControl, WFDISABLED)) {
00220
PWND pwndParent =
_GetParent(pwndControl);
00221
if (!pwndParent)
00222 {
00223
ThreadUnlock( &tlpwndControl );
00224
ThreadUnlock( &tlpwndChild );
00225
return;
00226 }
00227 pwndSend = pwndParent;
00228 }
else {
00229 pwndSend = pwndControl;
00230 }
00231
00232
ThreadLockAlways(pwndSend, &tlpwndSend);
00233
xxxSendHelpMessage( pwndSend, HELPINFO_WINDOW,
id,
00234 (HANDLE)
HWq(pwndControl),
GetContextHelpId(pwndControl));
00235
ThreadUnlock(&tlpwndSend);
00236
ThreadUnlock(&tlpwndControl);
00237
ThreadUnlock(&tlpwndChild);
00238
return;
00239 }
00240
ThreadUnlock(&tlpwndChild);
00241
break;
00242
00243 }
00244
else if ((
msg.message == WM_RBUTTONDOWN) ||
00245 (
msg.message == WM_MBUTTONDOWN) ||
00246 (
msg.message == WM_XBUTTONDOWN)) {
00247
00248
00249
00250
00251
break;
00252 }
00253
else if (
msg.message == WM_MOUSEMOVE) {
00254
if (
PtInRect(&rc,
msg.pt))
00255
zzzSetCursor(
SYSCUR(HELP));
00256
else
00257
zzzSetCursor(
SYSCUR(ARROW));
00258 }
00259
else if (
msg.message == WM_KEYDOWN &&
msg.wParam == VK_ESCAPE)
00260 {
00261
xxxGetMessage( &msg, NULL, 0, 0 );
00262
break;
00263 }
00264
00265
xxxGetMessage(&msg, NULL, 0, 0);
00266
xxxTranslateMessage(&msg, 0);
00267
xxxDispatchMessage(&msg);
00268 }
00269
00270
xxxReleaseCapture();
00271
zzzSetCursor(
SYSCUR(ARROW));
00272
xxxRedrawTitle(pwnd, DC_BUTTONS);
00273
00274
ClrWF(pwnd, WFHELPBUTTONDOWN);
00275
if (
FWINABLE()) {
00276
xxxWindowEvent(EVENT_OBJECT_STATECHANGE, pwnd, OBJID_TITLEBAR,
00277 INDEX_TITLEBAR_HELPBUTTON, 0);
00278
00279
xxxWindowEvent(EVENT_SYSTEM_CONTEXTHELPEND, pwnd, OBJID_WINDOW,
00280 INDEXID_CONTAINER, 0);
00281 }
00282 }