MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / SetMenu

Method SetMenu

source/script_gui.cpp:997–1017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

995}
996
997ResultType GuiType::SetMenu(ExprTokenType &aParam)
998{
999 UserMenu *menu = NULL;
1000 if (!TokenIsEmptyString(aParam))
1001 {
1002 menu = dynamic_cast<UserMenu *>(TokenToObject(aParam));
1003 if (!menu || menu->mMenuType != MENU_TYPE_BAR)
1004 return ResultToken().TypeError(_T("MenuBar"), aParam);
1005 menu->CreateHandle(); // Ensure the menu bar physically exists.
1006 menu->AddRef();
1007 }
1008 if (mMenu)
1009 mMenu->Release();
1010 mMenu = menu;
1011 ::SetMenu(mHwnd, menu ? menu->mMenu : NULL); // Add or remove the menu.
1012 if (menu) // v1.1.04: Keyboard accelerators.
1013 UpdateAccelerators(*menu);
1014 else
1015 RemoveAccelerators();
1016 return OK;
1017}
1018
1019
1020ResultType GuiType::ControlSetName(GuiControlType &aControl, LPTSTR aName)

Callers

nothing calls this directly

Calls 7

TokenIsEmptyStringFunction · 0.85
TokenToObjectFunction · 0.85
ResultTokenClass · 0.85
TypeErrorMethod · 0.80
CreateHandleMethod · 0.80
AddRefMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected