P3D::PdkServices::GetMenuService()->AddItem with unknown parent MenuID

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

P3D::PdkServices::GetMenuService()->AddItem with unknown parent MenuID

Post by BenBaron »

Hi guys,

I am adding a menu item to P3Ds menu. With SimConnect, this is automatically added to P3Ds Add-Ons menu item as a child. But now, with the PDK method, the menu item is placed directly in the main menu bar, which I don't want. So, is it somehow possible to retrieve the MenuID of an existing menu item (Add-Ons) to pass it to AddItem as parent argument?

All the best, Benny
User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Re: P3D::PdkServices::GetMenuService()->AddItem with unknown parent MenuID

Post by Beau Hollis »

I believe you can use ADDON_ITEM_ID. The menu IDs for all the top level items are listed in the MenuService header:
#define NO_PARENT 0x0000
#define SCENARIO_ITEM_ID 0x1001
#define VEHICLE_ITEM_ID 0x1002
#define WORLD_ITEM_ID 0x1003
#define OPTIONS_ITEM_ID 0x1004
#define VIEWS_ITEM_ID 0x1005
#define HELP_ITEM_ID 0x1006
#define WINGMEN_ITEM_ID 0x1008
#define TOOLS_ITEM_ID 0x100d
#define TEST_ITEM_ID 0x100e
#define ADDON_ITEM_ID 0x1010
#define ANALYSIS_ITEM_ID 0x1011
#define NETWORK_ITEM_ID 0x1012
#define NAVIGATION_ITEM_ID 0x1013
#define ALL_CHILDREN 0xFFFF
Thanks
Beau Hollis
Prepar3D Software Architect
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: P3D::PdkServices::GetMenuService()->AddItem with unknown parent MenuID

Post by BenBaron »

Thanks Beau for your reply and the hint for the defines.

SCENARIO_ITEM_ID or ANALYSIS_ITEM_ID are working fine as parent MenuID. ADDON_ITEM_ID doesn't work, though. Produces a HRESULT of E_FAIL.

Greets, Benny
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: P3D::PdkServices::GetMenuService()->AddItem with unknown parent MenuID

Post by BenBaron »

So, unfortunately this still produces the above mentioned error in 4.5 on my side. Not able to add a menu item to the Addon submenu.

All the best,

Benny
Kaiii3
Posts: 289
Joined: Tue Feb 10, 2015 1:14 pm

Re: P3D::PdkServices::GetMenuService()->AddItem with unknown parent MenuID

Post by Kaiii3 »

I can confirm that using the latest SDK/PDK it is still not working using follwoing code:

Code: Select all

MenuService->AddItem(MenuItemAIG->GetId(), ADDON_ITEM_ID, 0);
Image
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: P3D::PdkServices::GetMenuService()->AddItem with unknown parent MenuID

Post by BenBaron »

Hi guys,

just wanted to chime in that also with Prepar3D v4 SDK 4.5.13.32097 this doesn't seem to be fixed.

Greets,

Benny
Post Reply