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

BenBaron
Posts: 63
Joined: Fri Jan 16, 2015 7:51 am

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

Postby BenBaron » Thu Feb 21, 2019 5:20 pm

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: 1885
Joined: Wed Oct 06, 2010 3:25 pm

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

Postby Beau Hollis » Thu Feb 21, 2019 5:31 pm

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: 63
Joined: Fri Jan 16, 2015 7:51 am

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

Postby BenBaron » Thu Feb 21, 2019 6:19 pm

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: 63
Joined: Fri Jan 16, 2015 7:51 am

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

Postby BenBaron » Mon Apr 15, 2019 4:09 pm

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: 21
Joined: Tue Feb 10, 2015 1:14 pm

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

Postby Kaiii3 » Mon Jul 08, 2019 11:25 am

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


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 1 guest