I'm designing a custom window border, and i put a bitmap on the top as a drag bar. This works, however when i try to drag the window, it places itself in two different areas and flickers between the two. Here's a video:
http://dl.dropbox.com/u/85700751/capture-1.avi
When the window is flashing, i'm trying to drag it (it doesn't show my cursor for some reason). Here's my dragging code:
case WM_LBUTTONDOWN: {
int posX = LOWORD(lParam);
int posY = HIWORD(lParam);
if((isDragging==false)&&(posX>4)&&(posX<470)&&(posY>4)&&(posY<24))
{
isDragging = true;
ClipCursor(rect);
oldCursorX = posX;
oldCursorY = posY;
}
}
break;
case WM_LBUTTONUP: {
isDragging = false;
ClipCursor(NULL);
}
break;
case WM_MOUSEMOVE: {
if(isDragging) {
SetWindowPos(hWnd, NULL, LOWORD(lParam)-oldCursorX, HIWORD(lParam)-oldCursorY, 500, 500, NULL);
}
}
break;