Drag and click events, winapi

I have a window which I only use to display an image on screen (something like a splash screen) and I want to make it draggable and when it's clicked to get the coordinates where it was clicked.

It's probably simple, but I didn't do this before and couldn't find the answer googling. I believe I would get the message in WindowProc calback function, but not sure how to handle it?
Last edited on
The message you want is WM_LBUTTONDOWN(or WM_MBUTTONDOWN, WM_RBUTTONDOWN):

http://msdn.microsoft.com/en-us/library/windows/desktop/ms645607%28v=vs.85%29.aspx


1
2
3
4
5
6
7
8
9
POINT Cursor;
...

case WM_LBUTTONDOWN:
    Cursor.x = GET_X_LPARAM(lparam);
    Cursor.y = GET_Y_LPARAM(lparam);

    // do dragging
    SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);


Also, I think this belongs on the Windows Programming board.
Yea, I probably got too used to general subforum that i forgot that there is a windows subforum xd
Moved it now.

Thanks, I'll try this when I have time.
Topic archived. No new replies allowed.