i did a class for tell me what child controls the form have. and another class for tell me the last child control position(more big top and left) inclued the bottom\right.
ok. i have the most big X(the last control plus it's width) and:

RECT rtcParent;
        GetClientRect(ActivatedForm,&rtcParent);

heres how i'm trying calculate the nMax for the horizontal scrollbar:

if(ws.x>rtcParent.right)
                SCinfo.nMax =ws.y-rtcParent.bottom + GetSystemMetrics(SM_CXVSCROLL) + 7;
            else
                SCinfo.nMax =ws.y-rtcParent.bottom +7 ;

but i can't see the most right button :(
so the nMax calculation is incorrect. the X seems correct, because i debug it.
can anyone explain to me how can i calculate it?

the nPage is the parent client bottom and the nMax is the entire scroll area(vertical\horizontal).