i did these code for change the border for the STATIC window:
Code:
void setBorder(bool border)
    {
        long s;
        if(border==false)
            s = WS_EX_LEFT| WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR;
        else
            s = WS_EX_LEFT| WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_CLIENTEDGE;

        long a=(long)SetWindowLongPtr(hwnd,GWL_EXSTYLE,(LONG_PTR)s);
        MessageBox(NULL,to_string(GetLastError()).c_str(),"erro",MB_OK);
        //the SetWindowPos() is for update the control
        SetWindowPos(NULL, 0, 0, 0, 0,
                SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|
                SWP_DRAWFRAME,true);
    }
(the hwnd is value from CreateWindowEx())
but i get these error from GetLastError(): 6 - ERROR_INVALID_HANDLE.
why these error?