P
falls es jemanden interessiert, so läuft's ganz ordentlich:
LRESULT CALLBACK DragProc(HWND hWnd,UINT msg,WPARAM wParam, LPARAM lParam)
{
static bool isDragging=false;
static POINT start;
switch(msg)
{
case WM_MOUSEMOVE:
{
if(isDragging)
{
POINT coord;
coord.x=(signed short)LOWORD(lParam);
coord.y=(signed short)HIWORD(lParam);
ClientToScreen(hWnd,&coord);
ScreenToClient(hParent,&coord);
if(coord.x-start.x<0)
coord.x=start.x;
if(coord.y-start.y<0)
coord.y=start.y;
SetWindowPos(hWnd,HWND_TOP,
coord.x-start.x,coord.y-start.y,
0,0,SWP_NOSIZE);
}
}
break;
case WM_LBUTTONDOWN:
SetCapture(hWnd);
start.x=LOWORD(lParam);
start.y=HIWORD(lParam);
isDragging=true;
break;
case WM_LBUTTONUP:
isDragging=false;
ReleaseCapture();
break;
default:
return DefWindowProc(hWnd,msg,wParam,lParam);
}
return 0;
}
m.f.G.
Pablo