As per Dave's suggestion, I have added format submenu in the edit menu. Just move the code for the indent/outdent to BlockIndent function & for commet/uncomment to BlockComment function. And called these function from the event function for the format menus and from the ctlSQLBox::OnKeyDown function, from where it has been moved.