windows-nt/Source/XPSP1/NT/admin/activec/samples/sdksamples/cmenu/sky.cpp
2020-09-26 16:20:57 +08:00

67 lines
1.8 KiB
C++

//==============================================================;
//
// This source code is only intended as a supplement to
// existing Microsoft documentation.
//
//
//
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
//
//
//
//==============================================================;
#include "Sky.h"
const GUID CSkyBasedVehicle::thisGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } };
//==============================================================
//
// CSkyBasedVehicle implementation
//
//
HRESULT CSkyBasedVehicle::OnAddMenuItems(IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
{
HRESULT hr = S_OK;
CONTEXTMENUITEM menuItemsNew[] =
{
{
L"Sky based", L"Add a new sky based vehicle",
IDM_NEW_SKY, CCM_INSERTIONPOINTID_PRIMARY_NEW, 0, CCM_SPECIAL_DEFAULT_ITEM
},
{ NULL, NULL, 0, 0, 0 }
};
// Loop through and add each of the menu items
if (*pInsertionsAllowed & CCM_INSERTIONALLOWED_NEW)
{
for (LPCONTEXTMENUITEM m = menuItemsNew; m->strName; m++)
{
hr = pContextMenuCallback->AddItem(m);
if (FAILED(hr))
break;
}
}
return hr;
}
HRESULT CSkyBasedVehicle::OnMenuCommand(IConsole *pConsole, long lCommandID)
{
switch (lCommandID)
{
case IDM_NEW_SKY:
pConsole->MessageBox(L"This sample does not create a new item\nSee Complete sample for a demonstration", L"Menu Command", MB_OK|MB_ICONINFORMATION, NULL);
break;
}
return S_OK;
}