As Richard says some of the edit controls styles cannot been changed if the control still exist. But you can replace the control by a new one. If the control handles (HWND) are stored by the program you have to replace the by the new handle. Please don't try this solution with MFC classes.
snippet:
typedef void (*FNCHANGESTYLE)(long&,long&);
HWND replacecontrol(HWND h,const int idc,FNCHANGESTYLE fnchange)
{
HWND hwnd;
HWND prev;
RECT rc;
POINT pt = {0,0};
HINSTANCE hinst;
long style;
long exstyle;
TCHAR text[256];
TCHAR scls[256];
HFONT hfont;
int focus;
hwnd = GetDlgItem(h,idc);
if(!IsWindow(hwnd)) return 0;
prev = GetWindow(hwnd,GW_HWNDPREV);
hinst = (HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE);
style = GetWindowLong(hwnd,GWL_STYLE);
exstyle = GetWindowLong(hwnd,GWL_EXSTYLE);
focus = hwnd == GetFocus();
hfont = (HFONT)SendMessage(hwnd,WM_GETFONT,0,0);
ClientToScreen(h,&pt);
GetWindowRect(hwnd,&rc);
GetClassName(hwnd,scls,sizeof(scls)/sizeof(scls[0]));
GetWindowText(hwnd,text,sizeof(text)/sizeof(text[0]));
DestroyWindow(hwnd);
fnchange(style,exstyle);
hwnd = CreateWindowEx
(
exstyle,
scls,
text,
style,
rc.left-pt.x,
rc.top-pt.y,
rc.right-rc.left,
rc.bottom-rc.top,
h,
(HMENU)idc,
hinst,
0
);
SendMessage(hwnd,WM_SETFONT,(WPARAM)hfont,1);
SetWindowPos(hwnd,prev,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
if(focus) SetFocus(hwnd);
return hwnd;
}
void modES_AUTOHSCROLL(long& style,long& exstyle)
{
style ^= ES_AUTOHSCROLL;
}
void modES_PASSWORD(long& style,long& exstyle)
{
style ^= ES_PASSWORD;
}
void changestyle(HWND hdlg)
{
HWND hwnd;
HWND htxt;
hwnd = replacecontrol(hdlg,101,modES_AUTOHSCROLL);
hwnd = replacecontrol(hdlg,103,modES_PASSWORD);
}
Good luck.