ChangeDisplaySettings actually returns a value saying what went wrong. Instead of checking for the successful result only try using a switch with something more than just 'Failure'. If you check the docs the possible return values are:
DISP_CHANGE_SUCCESSFUL
DISP_CHANGE_BADDUALVIEW
DISP_CHANGE_BADFLAGS
DISP_CHANGE_BADMODE
DISP_CHANGE_BADPARAM
DISP_CHANGE_FAILED
DISP_CHANGE_NOTUPDATED
DISP_CHANGE_RESTART