heres my function for convert to client using RECT:
void ScreenToClient(HWND WindowDestination, RECT *WindowRectangle)
{
POINT a={WindowRectangle->right, WindowRectangle->bottom};
WindowRectangle->left=0;
WindowRectangle->top=0;
::ScreenToClient(WindowDestination,&a);
WindowRectangle->right=a.x;
WindowRectangle->bottom=a.y;
}
maybe have some errors too :(
void Center()
{
RECT frm,frmparent;
GetWindowRect(GetParent(hwnd), &frmparent);
ScreenToClient(GetParent(hwnd),&frmparent);
GetWindowRect(hwnd, &frm);
ScreenToClient(hwnd,&frm);
LONG x=frmparent.right/2 - (frm.right-frm.left)/2;
LONG y=100;
SetWindowPos(hwnd,0,x,y,0,0, SWP_NOSIZE | SWP_NOZORDER);
}
i'm trying calculate the x and y positions for the control. but i'm getting a big values even with 7 digits :(
can anyone correct me please?