In my program the commands are on left hand side , I want to move thses buttons to middle of window on click of mouse.
I wrote this code n=but buttons are disappearing. Any solution
case WM_LBUTTONDOWN:
RECT buttonScreenRect;
GetWindowRect(hButton, &buttonScreenRect);
POINT buttonClientPoint;
//buttonClientPoint.x = hButton.left;
buttonClientPoint.x = buttonScreenRect.left;
buttonClientPoint.y = buttonScreenRect.top;
ScreenToClient(hButton, &buttonClientPoint);
//MoveWindow(hButton,cxClient/2,cyClient/2,333,212,true);
//MoveWindow(hButton, 50, buttonClientPoint.y, buttonScreenRect.right - buttonScreenRect.left, buttonScreenRect.bottom - buttonScreenRect.top,true);
MoveWindow(hButton, 150, buttonClientPoint.y/2, buttonScreenRect.right - buttonScreenRect.left, buttonScreenRect.bottom - buttonScreenRect.top, true);
return 0;