The created command directory does not appear

Dear all,
I have created a new command directory with G4UIdirectory as the bellow:

MyMessenger::MyMessenger(MyController * control)
    controller = control;
    gammaknifeDir = new G4UIdirectory( "/gammaknifeCtrl/");
    gammaknifeDir->SetGuidance("Commands related to the GammaKnife model");
    beamOnCommand = new G4UIcmdWithAnInteger( "/gammaknifeCtrl/beamOn", this);

    delete beamOnCommand;
    delete gammaknifeDir;

void MyMessenger::SetNewValue(G4UIcommand * cmd, G4String newValue)
    if (cmd == beamOnCommand)
        controller->BeamOn( beamOnCommand->GetNewIntValue( newValue ) );

There are none of the errors when I build the source code. But I can not find this command. Can anyone help me, plz?