396Microsoft Visual Studio 2010: A Beginner’s Guide
vsCommandStatusTextWanted neededText, ref vsCommandStatus status,
ref object commandText)
{
if(neededText == vsCommandStatusTextWanted
.vsCommandStatusTextWantedNone)
{
if(commandName == "KeystrokeFinder.Connect.KeystrokeFinder")
{
status = (vsCommandStatus)
vsCommandStatus.vsCommandStatusSupported
vsCommandStatus.vsCommandStatusEnabled;
return;
}
}
}
VB:
Public Sub QueryStatus(
ByVal commandName As String,
ByVal neededText As vsCommandStatusTextWanted, ByRef status As vsCommandStatus,
ByRef commandText As Object) Implements IDTCommandTarget. QueryStatus
If neededText = vsCommandStatusTextWanted.vsCommandStatusTextWantedNone Then
If commandName = "KeystrokeFinderVB.Connect.KeystrokeFinderVB" Then
status = CType(vsCommandStatus.vsCommandStatusEnabled +
vsCommandStatus.vsCommandStatusSupported,
vsCommandStatus)
Else
status = vsCommandStatus.vsCommandStatusUnsupported
End If
End If
End Sub