i did these code for change the text alignment:
Code:
void setTextAlignment(int textalignment)
{
long s;
if(textalignment!=intTextAlignment)
{
//delete the last text alignment
if(intTextAlignment==0)
{
s = GetWindowLongPtr(hwnd,GWL_STYLE);
s = s & ~(SS_LEFT);
SetWindowLongPtr(hwnd,GWL_STYLE,(LONG_PTR)s);
}
else if (intTextAlignment==1)
{
s = GetWindowLongPtr(hwnd,GWL_STYLE);
s = s & ~(SS_CENTER);
SetWindowLongPtr(hwnd,GWL_STYLE,(LONG_PTR)s);
}
else if(intTextAlignment==2)
{
s = GetWindowLongPtr(hwnd,GWL_STYLE);
s = s & ~(SS_RIGHT);
SetWindowLongPtr(hwnd,GWL_STYLE,(LONG_PTR)s);
}
textalignment=intTextAlignment;
//put the new text alignment
if(textalignment==0)
{
s = GetWindowLongPtr(hwnd,GWL_STYLE);
s = s | (SS_LEFT);
SetWindowLongPtr(hwnd,GWL_STYLE,(LONG_PTR)s);
}
else if (textalignment==1)
{
s = GetWindowLongPtr(hwnd,GWL_STYLE);
s = s | (SS_CENTER);
SetWindowLongPtr(hwnd,GWL_STYLE,(LONG_PTR)s);
}
else if(textalignment==2)
{
s = GetWindowLongPtr(hwnd,GWL_STYLE);
s = s | (SS_RIGHT);
SetWindowLongPtr(hwnd,GWL_STYLE,(LONG_PTR)s);
}
SetWindowPos(hwnd, 0, 0, 0, 0, 0,
SWP_NOZORDER| SWP_NOSIZE | SWP_NOMOVE|SWP_NOACTIVATE |SWP_NOCOPYBITS | SWP_DRAWFRAME);
}
}
but, by some reason, the aligment isn't changed... and i don't understand why
can anyone explain what i'm doing wrong?