I assume you mean you've created a class implementing the ICommand interface. If so, you need to put your enable/disable logic in the ICommand::Enabled method. Return true to enable the command and false to disable it. You'll need something like the following:
Dim pActiveView as IActiveView
pActiveView = pMxDoc.ActiveView
If Typeof pActiveView Is IMap Then
' Map object
return true
Else
' PageLayout object
return false
End If