Declare a boolean variable in your class,
Code:
BOOL bState;
add a handler to your menu/toolbar click and toogle the value of boolean there
Code:
bState = !bState;
and in ON_UPDATEUI_XXX hadler just add following
Code:
PCmdUI->SetCheck(bState);
Amit