how can i auto size a control?
i'm trying these code without sucess
Code:
void setAutoSize(bool autosize)
    {
        long s=0;
        if (autosize==true)
        {
            char a[256];
            GetWindowText(hwnd,a,256);
            SIZE b;
            GetTextExtentPoint32(GetDC(hwnd),a,strlen(a),&b);
            RECT c;
            GetWindowRect(hwnd,&c);
            c.bottom=c.top+b.cy;
            c.right=c.left+b.cx;
            LONG s=GetWindowLongPtr(hwnd,GWL_EXSTYLE);
            LONG g=GetWindowLongPtr(hwnd,GWL_STYLE);
            AdjustWindowRectEx (&c,g,FALSE,s );
            SetWindowPos(hwnd, 0, 0, 0, 0, 0,
                                 SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE|
                                 SWP_DRAWFRAME | SWP_FRAMECHANGED| SWP_NOSIZE);
        }
    }
i even try the ControlSpyV6(a program for test and combine the styles and extended styles) without sucess
can anyone advice me?