Completed by dragging and dropping win32, made unchanged, cannot receive the change with an invalid (sparse circle) cursor

I have a rather difficult problem, but I will try my best. I made a special drag-drop implementation for a Win32-based GUI application. Due to program limitations, I cannot use the proper OLE drag and drop mechanism. Its okey, I made my own with mouse tracking, and it works like this. The only problem I can’t solve now is the bloody invalid (sparse circle) cursor IDC_NO.

My window says that it cannot be processed and changes the cursor to invalid when something is about to fall. I tried everything to change it, but he insists on staying there.

case WM_SETCURSOR:
{
    //SetSystemCursor(CopyCursor(LoadCursor(NULL, IDC_CROSS)), 32648);
    //DestroyCursor();
    SetCursor(LoadCursor(NULL, IDC_CROSS));
    SetWindowLong(hwnd, DWL_MSGRESULT, TRUE);
    return TRUE;
}
break;

, . , . IDC_CROSS, IDC_NO.

? IDC_CROSS.

OLE MFC, .

, , ;)

+3
3

. WM_SETCURSOR, D + D. COM , " ". , , .

"OLE" MFC, , . IDropTarget:: DragEnter, . , , , .

+1

. :

ScreenToClient(hwnd, &point);

RECT clearRect;
clearRect.left = point.x - 128;
clearRect.top = point.y - 128;
clearRect.right = point.x + 128;
clearRect.bottom = point.y + 128;
InvalidateRect(hwnd, &clearRect, TRUE);

UpdateWindow(hwnd);

DrawIcon(GetDC(hwnd), point.x, point.y, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(YOUR_RESOURCE_ID)));
+2

Do you record your window for receiving dragged files using the function DragAcceptFiles? ( http://msdn.microsoft.com/en-us/library/bb776406%28VS.85%29.aspx ) This is useful for getting a very simple drag and drop function without going to OLE, but does not provide such versatility because you get message WM_DROPFILESafter releasing the mouse button.

+1
source

Source: https://habr.com/ru/post/1762648/


All Articles