I need to create menu items on top of my DX11 windowed app - similar to most windowed applications (File, Edit, etc...). How can I achieve this ? There is a hMenu
handle to pass to the DirectX window creation function but I have no idea how to create this object.
Additionnaly I'd like to have 1 or several ribbons under the window menu with icons to trigger functionnality.
EDIT My menu is all good now and I chose to implement a windows ribbon, but I'm still having problems at creating the ribbon. Here is a screenshot of my app. The green color is the Direct3D clear color - I would like my ribbon to display under the menu (and eventually remove the menu after that).
My ribbon code being :
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT paintStruct;
HDC hDC;
switch (message)
{
case WM_CREATE:
{
if (!SetupMenus(hwnd)) MessageBox(nullptr, TEXT("Failed to setup GUI."), TEXT("Error"), MB_OK);
}
// ...
}
bool SetupMenus(HWND hwnd) {
// Create the menu
// ...
// Create the ribbon
IUIFramework* pFramework = NULL;
HRESULT hr = ::CoCreateInstance(CLSID_UIRibbonFramework, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pFramework));
if (FAILED(hr)) std::cerr << "Fail #1" << std::endl;
hr = pFramework->Initialize(hwnd, IUIApp);
if (FAILED(hr)) std::cerr << "Fail #2" << std::endl;
}
outputs Fail #1
. Why can't I create the ribbon ?