Для любителей удобств - олдстайл меню по комбинации Ctrl+\
Открывает новое, или восстанавливает свернутое или прячет главное меню.
Можно еще доделать например по Ctrl+Shift+\ управлять всеми главными меню, а не только текущей компании.
Info\onEventGoingIdle
X++:
if (winApi::getForegroundWindow() == infolog.hWnd())
{
// MainMenu >
if (WinAPI::getAsyncKeyState(#control, (0xE2), 0)) // Ctrl + \
{
DEV_RunMainMenu::showHideMM();
}
// MainMenu <
}
X++:
static client void showHideMM()
{
#WinAPI
#AOT
#define.USER32('USER32')
#define.GetTopWindow('GetTopWindow')
#define.MDIClient('MDIClient')
HWND mainMenu;
DLL user32;
DLLFunction getTopWindow;
str st1, st2;
;
user32 = new DLL(#USER32);
getTopWindow = new DLLFunction(user32, #GetTopWindow);
getTopWindow.returns(ExtTypes::DWord);
getTopWindow.arg(ExtTypes::DWord);
mainMenu = getTopWindow.call(WinAPI::findWindowEx(infolog.hWnd(), 0, #MDIClient, ''));
st1 = WinAPI::getWindowText(mainMenu);
st2 = strReplace(strfmt('Main menu - %1 (%2)',
(select firstonly DataArea where DataArea.Id == curext()).name, curext()), '-', '.');
if ( mainMenu
&& match(st2, st1))
{
WinAPI::minimizeWindow(mainMenu);
sleep(100);
}
else if (appl.globalCache().isSet(classstr(DEV_RunMainMenu), curext()))
{
mainMenu = any2int(appl.globalCache().get(classstr(DEV_RunMainMenu), curext(), null));
if ( mainMenu
&& WinAPI::isWindowVisible(mainMenu))
{
WinAPI::sendMessageEx(mainMenu, #WM_SYSCOMMAND, #SC_RESTORE, 0);
}
else
{
appl.globalCache().remove(classstr(DEV_RunMainMenu), curext());
TreeNode::findNode(#MenusPath + #AOTRootPath + menustr(MainMenu)).AOTrun();
sleep(100);
mainMenu = getTopWindow.call(WinAPI::findWindowEx(infolog.hWnd(), 0, #MDIClient, ''));
appl.globalCache().set(classstr(DEV_RunMainMenu), curext(), mainMenu);
}
}
else
{
TreeNode::findNode(#MenusPath + #AOTRootPath + menustr(MainMenu)).AOTrun();
sleep(100);
mainMenu = getTopWindow.call(WinAPI::findWindowEx(infolog.hWnd(), 0, #MDIClient, ''));
appl.globalCache().set(classstr(DEV_RunMainMenu), curext(), mainMenu);
}
}
WinAPI
X++:
//>> : MXK 04/09/08-13:05:07 >
client static boolean getAsyncKeyState(int _key1 = 0, int _key2 = 0, int _key3 = 0)
{
DLL _winApiDLL = new DLL(#UserDLL);
DLLFunction _getKeyState = new DLLFunction(_winApiDLL, identifierstr(GetAsyncKeyState));
boolean ret1, ret2, ret3;
;
_getKeyState.returns(ExtTypes::Word);
_getKeyState.arg(ExtTypes::DWord);
ret1 = _key1 ? _getKeyState.call(_key1) & 0x8000 : false;
ret2 = _key2 ? _getKeyState.call(_key2) & 0x8000 : false;
ret3 = _key3 ? _getKeyState.call(_key3) & 0x8000 : false;
return (_key1 ? ret1 : true)
&& (_key2 ? ret2 : true)
&& (_key3 ? ret3 : true);
}
//<< : MXK 04/09/08-13:05:07 >