#if ASYNC // Loop for determining the drop-file client window SetCapture(hWnd); do { MSG Msg; while (PeekMessage(&Msg, NULL, NULL, NULL, PM_REMOVE)) if ( Msg.message != WM_LBUTTONDOWN && Msg.message != WM_RBUTTONDOWN ) DispatchMessage(&Msg); else has_been_down = 1; // Get cursor position & window under the cursor GetCursorPos(&ptMousePos); hWndSubject = WindowFromPoint(ptMousePos); fOkToDrop = FALSE; #ifdef CLIPDROP { HWND hWndCur = hWndSubject; if ( IsOther ) switch ( IsClipbordDrop(hWnd,&hWndCur,&ptMousePos) ) { case 0: break; case -1: continue; default: retval = DropClipboard(hWnd,hWndCur,szAllFileNames,wNumFiles); goto go_away; } } #endif CLIPDROP while ( IsWindow(hWndSubject) ) { #ifdef DROP_MESSAGE ScreenToClient(hWndSubject, &ptMousePos); DragSetPoint(hDrop,&ptMousePos); if ( SendMessage(hWndSubject,wm_querydropobject,0,MAKELONG(hDrop,0)) ) { #else if ( (GetWindowLong(hWndSubject, GWL_EXSTYLE) & WS_EX_ACCEPTFILES)) { #endif fOkToDrop = TRUE; if ( hWndSubject == hWnd ) { IsSelf = 1; if ( IsOther == 0 ) fOkToDrop = FALSE; } else { IsSelf = 0; IsOther = 1; } goto ShowCursor; } hWndSubject = GetParent(hWndSubject); } IsOther = 1; ShowCursor: if ( fOkToDrop ) SetCursor((wNumFiles > 1) ? hCrsrDrpMultiple : hCrsrDrpSingle); else SetCursor(hCrsrDrpNotAllow); // Terminate loop when mouse button is released state = ( GetAsyncKeyState(VK_LBUTTON) & 0x8000 ) | ( GetAsyncKeyState(VK_RBUTTON) & 0x8000 ); if ( state ) has_been_down = 1; } while ( state || !has_been_down); go_away: ReleaseCapture(); #endif