void InitMenuItems(void) { CLISTMENUITEM mi = { sizeof(mi) }; // support new genmenu style mi.flags = CMIF_ROOTHANDLE|CMIF_TCHAR; mi.hParentMenu = HGENMENU_ROOT; // Build main menu mi.position = -1000000000 /*1000001*/; mi.ptszName = LPGENT(MODULNAME_PLU); mi.hIcon = IcoLib_GetIcon(PopupOptions.ModuleIsEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF ,0); hMenuRoot = Menu_AddMainMenuItem(&mi); // Add item to main menu mi.hParentMenu = (HGENMENU)hMenuRoot; CreateServiceFunction(MENUCOMMAND_SVC, svcEnableDisableMenuCommand); mi.ptszName = PopupOptions.ModuleIsEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"); mi.pszService = MENUCOMMAND_SVC; hMenuItem = Menu_AddMainMenuItem(&mi); // Popup History CreateServiceFunction(MENUCOMMAND_HISTORY, svcShowHistory); mi.position = 1000000000; mi.popupPosition = 1999990000; mi.ptszName = LPGENT("Popup History"); mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0); mi.pszService = MENUCOMMAND_HISTORY; hMenuItemHistory = Menu_AddMainMenuItem(&mi); }
int ModulesLoad(WPARAM, LPARAM) { profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%")); if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) { HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath); FoldersGetBackupPath(0, 0); } CreateServiceFunction(MS_AB_BACKUP, ABService); CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs); CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500100000); mi.name.a = LPGEN("Backup profile"); mi.pszService = MS_AB_BACKUP; mi.hIcolibItem = iconList[0].hIcolib; mi.position = 500100000; Menu_AddMainMenuItem(&mi); mi.name.a = LPGEN("Save profile as..."); mi.pszService = MS_AB_SAVEAS; mi.hIcolibItem = iconList[1].hIcolib; mi.position = 500100001; Menu_AddMainMenuItem(&mi); HookEvent(ME_OPT_INITIALISE, OptionsInit); LoadOptions(); if (options.backup_types & BT_START) BackupStart(NULL); return 0; }
void InitMenu() { CMenuItem mi(g_plugin); mi.flags = CMIF_UNICODE | CMIF_NOTOFFLINE; mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("News Aggregator"), 500099000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "D9733E4F-1946-4390-8EB3-591E8687222E"); SET_UID(mi, 0x3ec91864, 0xefa7, 0x4994, 0xb7, 0x75, 0x6c, 0x96, 0xcb, 0x29, 0x2f, 0x93); mi.position = 10100001; if (db_get_b(NULL, MODULENAME, "AutoUpdate", 1)) mi.name.w = LPGENW("Auto Update Enabled"); else mi.name.w = LPGENW("Auto Update Disabled"); mi.hIcolibItem = GetIconHandle("main"); mi.pszService = MS_NEWSAGGREGATOR_ENABLED; hService2[0] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x8076bb4d, 0x1e44, 0x43af, 0x97, 0x1e, 0x31, 0xd8, 0xa4, 0xe9, 0xb8, 0x37); mi.position = 20100001; mi.name.w = LPGENW("Check All Feeds"); mi.pszService = MS_NEWSAGGREGATOR_CHECKALLFEEDS; hService2[1] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xb876484d, 0x28aa, 0x4e03, 0x9e, 0x98, 0xed, 0xbc, 0xd1, 0xcf, 0x31, 0x80); mi.position = 20100002; mi.hIcolibItem = GetIconHandle("addfeed"); mi.name.w = LPGENW("Add Feed"); mi.pszService = MS_NEWSAGGREGATOR_ADDFEED; hService2[2] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x600bf2c2, 0xa974, 0x44d3, 0x98, 0xf9, 0xe6, 0x65, 0x7c, 0x1f, 0x63, 0x37); mi.position = 20100003; mi.hIcolibItem = GetIconHandle("importfeeds"); mi.name.w = LPGENW("Import Feeds"); mi.pszService = MS_NEWSAGGREGATOR_IMPORTFEEDS; hService2[3] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xc09c8119, 0x64c2, 0x49bd, 0x81, 0xf, 0x54, 0x20, 0x69, 0xd7, 0x30, 0xcf); mi.position = 20100004; mi.hIcolibItem = GetIconHandle("exportfeeds"); mi.name.w = LPGENW("Export Feeds"); mi.pszService = MS_NEWSAGGREGATOR_EXPORTFEEDS; hService2[4] = Menu_AddMainMenuItem(&mi); // adding contact menu items SET_UID(mi, 0x92be499c, 0x928c, 0x4789, 0x8f, 0x36, 0x28, 0xa2, 0x9f, 0xb7, 0x1a, 0x97); mi.root = nullptr; mi.position = -0x7FFFFFFA; mi.hIcolibItem = GetIconHandle("checkfeed"); mi.name.w = LPGENW("Check feed"); mi.pszService = MS_NEWSAGGREGATOR_CHECKFEED; hService2[5] = Menu_AddContactMenuItem(&mi, MODULENAME); SET_UID(mi, 0x41a70fbc, 0x9241, 0x44c0, 0x90, 0x90, 0x87, 0xd2, 0xc5, 0x9f, 0xc9, 0xac); mi.name.w = LPGENW("Change feed"); mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED; hService2[6] = Menu_AddContactMenuItem(&mi, MODULENAME); Menu_ModifyItem(hService2[0], nullptr, GetIconHandle(db_get_b(NULL, MODULENAME, "AutoUpdate", 1) ? "enabled" : "disabled")); }
// Hook called after init static int MainInit(WPARAM wparam,LPARAM lparam) { InitProtocolData(); // Add options to menu CLISTMENUITEM mi = { sizeof(mi) }; mi.popupPosition = 500050000; mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_USERDETAILS); mi.ptszName = LPGENT("My Details"); HANDLE hMenuRoot = Menu_AddMainMenuItem(&mi); mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR; mi.ptszPopupName = (TCHAR *)hMenuRoot; mi.popupPosition = 0; mi.icolibItem = NULL; if (protocols->CanSetAvatars()) { mi.position = 100001; mi.ptszName = LPGENT("Set My Avatar..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYAVATARUI, Menu_SetMyAvatarUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYAVATARUI; Menu_AddMainMenuItem(&mi); } mi.position = 100002; mi.ptszName = LPGENT("Set My Nickname..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYNICKNAMEUI, Menu_SetMyNicknameUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYNICKNAMEUI; Menu_AddMainMenuItem(&mi); mi.position = 100003; mi.ptszName = LPGENT("Set My Status Message..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI, Menu_SetMyStatusMessageUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI; Menu_AddMainMenuItem(&mi); // Set protocols to show frame mi.position = 200001; mi.ptszName = LPGENT("Show next account"); mi.pszService = MS_MYDETAILS_SHOWNEXTPROTOCOL; Menu_AddMainMenuItem(&mi); InitFrames(); if ( Skin_GetIcon("LISTENING_TO_ICON") == NULL) Icon_Register(hInst, LPGEN("Contact List"), iconList, 1); Icon_Register(hInst, LPGEN("My Details"), iconList+1, SIZEOF(iconList)-1); return 0; }
// Hook called after init static int MainInit(WPARAM, LPARAM) { g_bAvsExist = ServiceExists(MS_AV_GETMYAVATAR) != 0; g_bFramesExist = ServiceExists(MS_CLIST_FRAMES_ADDFRAME) != 0; InitProtocolData(); // Add options to menu CLISTMENUITEM mi = { sizeof(mi) }; mi.popupPosition = 500050000; mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_USERDETAILS); mi.ptszName = LPGENT("My details"); HANDLE hMenuRoot = Menu_AddMainMenuItem(&mi); mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR; mi.ptszPopupName = (TCHAR *)hMenuRoot; mi.popupPosition = 0; mi.icolibItem = NULL; if (protocols->CanSetAvatars()) { mi.position = 100001; mi.ptszName = LPGENT("Set my avatar..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYAVATARUI, Menu_SetMyAvatarUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYAVATARUI; Menu_AddMainMenuItem(&mi); } mi.position = 100002; mi.ptszName = LPGENT("Set my nickname..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYNICKNAMEUI, Menu_SetMyNicknameUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYNICKNAMEUI; Menu_AddMainMenuItem(&mi); mi.position = 100003; mi.ptszName = LPGENT("Set my status message..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI, Menu_SetMyStatusMessageUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI; Menu_AddMainMenuItem(&mi); // Set protocols to show frame mi.position = 200001; mi.ptszName = LPGENT("Show next account"); mi.pszService = MS_MYDETAILS_SHOWNEXTPROTOCOL; Menu_AddMainMenuItem(&mi); InitFrames(); return 0; }
int SystemModulesLoaded(WPARAM, LPARAM) { //Insert "Check mail (YAMN)" item to Miranda's menu CMenuItem mi; SET_UID(mi, 0xa01ff3d9, 0x53cb, 0x4406, 0x85, 0xd9, 0xf1, 0x90, 0x3a, 0x94, 0xed, 0xf4); mi.position = 0xb0000000; mi.hIcolibItem = g_GetIconHandle(0); mi.name.a = LPGEN("Check &mail (All Account)"); mi.pszService = MS_YAMN_FORCECHECK; hMenuItemMain = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xfe22191f, 0x40c8, 0x479f, 0x93, 0x5d, 0xa5, 0x17, 0x1f, 0x57, 0x2f, 0xcb); mi.name.a = LPGEN("Check &mail (This Account)"); mi.pszService = MS_YAMN_CLISTCONTEXT; hMenuItemCont = Menu_AddContactMenuItem(&mi, YAMN_DBMODULE); SET_UID(mi, 0x147c7800, 0x12d0, 0x4209, 0xab, 0xcc, 0xfa, 0x64, 0xc6, 0xb0, 0xa6, 0xeb); mi.hIcolibItem = g_GetIconHandle(1); mi.name.a = LPGEN("Launch application"); mi.pszService = MS_YAMN_CLISTCONTEXTAPP; hMenuItemContApp = Menu_AddContactMenuItem(&mi, YAMN_DBMODULE); CheckMenuItems(); if (hAccountFolder = FoldersRegisterCustomPathT(LPGEN("YAMN"), LPGEN("YAMN Account Folder"), UserDirectory)) FoldersGetCustomPathT(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory); RegisterPOP3Plugin(0, 0); return 0; }
int MirandaLoaded(WPARAM wParam, LPARAM lParam) { InitPcre(); ModuleLoad(0, 0); COptPage PopupOptPage(g_PopupOptPage); PopupOptPage.DBToMem(); RecompileRegexps(*(TCString*)PopupOptPage.GetValue(IDC_POPUPOPTDLG_IGNORESTRINGS)); HookEvent(ME_OPT_INITIALISE, OptionsDlgInit); HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); SkinAddNewSoundEx(CLIENTCHANGED_SOUND, NULL, LPGEN("ClientChangeNotify: Client changed")); if (bPopupExists) { CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups); HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu); CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) mi.ptszName = LPGENT("Disable c&lient change notification"); else mi.ptszName = LPGENT("Enable c&lient change notification"); mi.pszService = MS_CCN_TOGGLEPOPUPS; mi.ptszPopupName = LPGENT("Popups"); g_hTogglePopupsMenuItem = Menu_AddMainMenuItem(&mi); } // seems that Fingerprint is not installed if (!bFingerprintExists && !db_get_b(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0)) CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), NULL, CCNErrorDlgProc); return 0; }
int LoadModules(void) { HookEvent(ME_OPT_INITIALISE,OptInitialise); HookEvent(ME_CLIST_PREBUILDCONTACTMENU,SmsRebuildContactMenu); HookEvent(ME_PROTO_ACK,handleAckSMS); HookEvent(ME_DB_EVENT_ADDED,handleNewMessage); HookEvent(ME_PROTO_ACCLISTCHANGED,RefreshAccountList); char szServiceFunction[MAX_PATH]; mir_snprintf(szServiceFunction,sizeof(szServiceFunction),"%s%s",PROTOCOL_NAMEA,SMS_SEND); CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 300050000; mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS); mi.ptszName = SMS_SEND_STR; mi.pszService = szServiceFunction; mi.flags = CMIF_TCHAR; Menu_AddMainMenuItem(&mi); mi.position = -2000070000; mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS); mi.ptszName = SMS_SEND_CM_STR; mi.pszService = szServiceFunction; mi.flags = CMIF_TCHAR; ssSMSSettings.hContactMenuItems[0] = Menu_AddContactMenuItem(&mi); SkinAddNewSoundEx("RecvSMSMsg",PROTOCOL_NAMEA,LPGEN("Incoming SMS Message")); SkinAddNewSoundEx("RecvSMSConfirmation",PROTOCOL_NAMEA,LPGEN("Incoming SMS Confirmation")); RefreshAccountList(NULL,NULL); RestoreUnreadMessageAlerts(); return 0; }
int SystemModulesLoaded(WPARAM, LPARAM) { //Insert "Check mail (YAMN)" item to Miranda's menu CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 0xb0000000; mi.icolibItem = g_GetIconHandle(0); mi.pszName = LPGEN("Check &mail (All Account)"); mi.pszPopupName = NULL;//YAMN_DBMODULE; mi.pszService = MS_YAMN_FORCECHECK; hMenuItemMain = Menu_AddMainMenuItem(&mi); mi.pszName = LPGEN("Check &mail (This Account)"); mi.pszContactOwner = YAMN_DBMODULE; mi.pszService = MS_YAMN_CLISTCONTEXT; hMenuItemCont = Menu_AddContactMenuItem(&mi); mi.icolibItem = g_GetIconHandle(1); mi.pszName = LPGEN("Launch application"); mi.pszContactOwner = YAMN_DBMODULE; mi.pszService = MS_YAMN_CLISTCONTEXTAPP; hMenuItemContApp = Menu_AddContactMenuItem(&mi); CheckMenuItems(); if (hAccountFolder = FoldersRegisterCustomPathT(LPGEN("YAMN"), LPGEN("YAMN Account Folder"), UserDirectory)) FoldersGetCustomPathT(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory); RegisterPOP3Plugin(0, 0); return 0; }
void SetShutdownMenuItem(bool fActive) { /* main menu */ CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 2001090000; if (fActive) { mi.icolibItem = iconList[1].hIcolib; mi.ptszName = LPGENT("Stop automatic &shutdown"); } else { mi.icolibItem = iconList[2].hIcolib; mi.ptszName = LPGENT("Automatic &shutdown..."); } mi.pszService = "AutoShutdown/MenuCommand"; mi.flags = CMIF_TCHAR; if (hMainMenuItem != NULL) { mi.flags |= CMIM_NAME | CMIM_ICON; Menu_ModifyItem(hMainMenuItem, &mi); } else hMainMenuItem = Menu_AddMainMenuItem(&mi); /* tray menu */ mi.position = 899999; if (hTrayMenuItem != NULL) { mi.flags |= CMIM_NAME | CMIM_ICON; Menu_ModifyItem(hTrayMenuItem, &mi); } else hTrayMenuItem = Menu_AddTrayMenuItem(&mi); }
extern "C" int __declspec(dllexport)Load(void) { mir_getLP(&pluginInfoEx); mir_getCLI(); CreateServiceFunction(protocolname"/ToggleEnable", ToggleEnable); CreateServiceFunction(protocolname"/ToggleAutoanswer",Toggle); CMenuItem mi; mi.position = 500090000; mi.name.t = _T(""); mi.pszService = protocolname"/ToggleEnable"; hEnableMenu = Menu_AddMainMenuItem(&mi); mi.position = -0x7FFFFFFF; mi.name.t = _T(""); mi.pszService = protocolname"/ToggleAutoanswer"; hToggle = Menu_AddContactMenuItem(&mi); //add hook HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_DB_EVENT_ADDED, addEvent); HookEvent(ME_SYSTEM_MODULESLOADED, CheckDefaults); Icon_RegisterT(hinstance, _T("Simple Auto Replier"), iconList, _countof(iconList)); return 0; }
extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); INITCOMMONCONTROLSEX icex; icex.dwSize = sizeof(icex); icex.dwICC = ICC_DATE_CLASSES; InitCommonControlsEx(&icex); if ((hUxTheme = LoadLibraryA("uxtheme.dll")) != 0) MyEnableThemeDialogTexture = (BOOL(WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); /// all initialization here hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_HISTORYICON)); hOpenWindowsList = WindowList_Create(); InitServices(); /// menu items CMenuItem mi; mi.name.t = LPGENT("View &history"); mi.flags = CMIF_TCHAR; mi.position = 1000090000; mi.hIcolibItem = hIcon; mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY; Menu_AddContactMenuItem(&mi); /// @todo (White-Tiger#1#08/19/14): fully implement System History someday^^ mi.name.t = LPGENT("&System History"); Menu_AddMainMenuItem(&mi); HookEvents(); return 0; }
extern "C" int __declspec(dllexport)Load(void) { mir_getLP(&pluginInfoEx); mir_getCLI(); CreateServiceFunction(protocolname"/ToggleEnable", ToggleEnable); CreateServiceFunction(protocolname"/ToggleAutoanswer", Toggle); CMenuItem mi; SET_UID(mi, 0xac1c64a, 0x82ca, 0x4845, 0x86, 0x89, 0x59, 0x76, 0x12, 0x74, 0x72, 0x7b); mi.position = 500090000; mi.name.t = _T(""); mi.pszService = protocolname"/ToggleEnable"; hEnableMenu = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xb290cccd, 0x4ecc, 0x475e, 0x87, 0xcb, 0x51, 0xf4, 0x3b, 0xc3, 0x44, 0x9c); mi.position = -0x7FFFFFFF; mi.name.t = _T(""); mi.pszService = protocolname"/ToggleAutoanswer"; hToggle = Menu_AddContactMenuItem(&mi); //add hook HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_DB_EVENT_ADDED, addEvent); HookEvent(ME_SYSTEM_MODULESLOADED, CheckDefaults); Icon_RegisterT(hinstance, _T("Simple Auto Replier"), iconList, _countof(iconList)); return 0; }
void SetShutdownMenuItem(bool fActive) { /* main menu */ CMenuItem mi; SET_UID(mi, 0x61e2a38f, 0xcd94, 0x4f72, 0x84, 0x8c, 0x72, 0x92, 0xde, 0x1d, 0x6d, 0x5); mi.position = 2001090000; if (fActive) { mi.hIcolibItem = iconList[1].hIcolib; mi.name.t = LPGENT("Stop automatic &shutdown"); } else { mi.hIcolibItem = iconList[2].hIcolib; mi.name.t = LPGENT("Automatic &shutdown..."); } mi.pszService = "AutoShutdown/MenuCommand"; mi.flags = CMIF_TCHAR; if (hMainMenuItem != NULL) Menu_ModifyItem(hMainMenuItem, mi.name.t, mi.hIcolibItem); else hMainMenuItem = Menu_AddMainMenuItem(&mi); /* tray menu */ mi.position = 899999; if (hTrayMenuItem != NULL) Menu_ModifyItem(hTrayMenuItem, mi.name.t, mi.hIcolibItem); else hTrayMenuItem = Menu_AddTrayMenuItem(&mi); }
MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(PROTO_INTERFACE *pThis) { if (pThis == NULL) return 0; if (db_get_b(NULL, "CList", "MoveProtoMenus", TRUE)) { if (pThis->m_hMainMenuItem != NULL) { Menu_RemoveItem(pThis->m_hMainMenuItem); pThis->m_hMainMenuItem = NULL; } return cli.pfnGetProtocolMenu(pThis->m_szModuleName); } TIntMenuObject *pmo = GetMenuObjbyId(hMainMenuObject); if (pmo == NULL) return NULL; mir_cslock lck(csMenuHook); for (TMO_IntMenuItem *p = pmo->m_items.first; p != NULL; p = p->next) if (!mir_strcmp(p->UniqName, pThis->m_szModuleName)) return p; // create protocol root in the main menu CMenuItem mi; mi.name.t = pThis->m_tszUserName; mi.position = 500090000; mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.hIcolibItem = pThis->m_hProtoIcon; return pThis->m_hMainMenuItem = Menu_AddMainMenuItem(&mi); }
extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\" DEFAULT_UPDATES_FOLDER)); mir_tstrncpy(tszRoot, tszFolder, _countof(tszRoot)); hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER); if (hPackUpdaterFolder) FoldersGetCustomPathT(hPackUpdaterFolder, tszRoot, MAX_PATH, _T("")); mir_free(tszFolder); LoadOptions(); InitPopupList(); NetlibInit(); IcoLibInit(); // Add cheking update menu item CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand); CMenuItem mi; SET_UID(mi, 0x326495e8, 0xab0a, 0x47d2, 0xb2, 0x22, 0x2a, 0x8e, 0xa8, 0xae, 0x53, 0x1a); mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = IcoLib_GetIcon("check_update"); mi.name.t = LPGENT("Check for pack updates"); mi.pszService = MODNAME"/CheckUpdates"; Menu_AddMainMenuItem(&mi); // Add empty updates folder menu item CreateServiceFunction(MODNAME"/EmptyFolder", EmptyFolder); memset(&mi, 0, sizeof(mi)); SET_UID(mi, 0xc3eea590, 0xaba3, 0x454f, 0x93, 0x93, 0xbc, 0x97, 0x15, 0x2c, 0x3b, 0x3d); mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = IcoLib_GetIcon("empty_folder"); mi.name.t = LPGENT("Clear pack updates folder"); mi.pszService = MODNAME"/EmptyFolder"; Menu_AddMainMenuItem(&mi); // Add options hook HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); return 0; }
static void addMenuItem(CMenuItem &mi) { if (g_AddContListMI) { HGENMENU save = mi.root; mi.root = NULL; Menu_AddContactMenuItem(&mi); mi.root = save; } Menu_AddMainMenuItem(&mi); }
static void MenuInit(void) { Icon_Register(hInst, LPGEN("Database")"/"LPGEN("Database backups"), iconList, SIZEOF(iconList)); CLISTMENUITEM mi = { sizeof(mi) }; mi.pszPopupName = LPGEN("Database"); mi.pszName = LPGEN("Backup profile"); mi.pszService = MS_AB_BACKUP; mi.icolibItem = iconList[0].hIcolib; mi.position = 500100000; Menu_AddMainMenuItem(&mi); mi.pszName = LPGEN("Save profile as..."); mi.pszService = MS_AB_SAVEAS; mi.icolibItem = iconList[1].hIcolib; mi.position = 500100001; Menu_AddMainMenuItem(&mi); }
int ModulesLoaded(WPARAM wParam,LPARAM lParam) { // Register menu item CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1900000001; mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)); mi.pszPopupName = "Database"; mi.pszName = modFullname; mi.pszService = "DBEditorpp/MenuCommand"; Menu_AddMainMenuItem(&mi); ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); mi.position = 1900000001; mi.flags = db_get_b(NULL, modname, "UserMenuItem", 0) ? 0 : CMIF_HIDDEN; mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGUSER)); mi.pszName = LPGEN("Open user tree in DBE++"); mi.pszService = "DBEditorpp/MenuCommand"; hUserMenu = Menu_AddContactMenuItem(&mi); // Register hotkeys HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = "hk_dbepp_open"; hkd.pszService = "DBEditorpp/MenuCommand"; hkd.ptszDescription = LPGEN("Open Database Editor"); hkd.ptszSection = modFullname; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D'); Hotkey_Register(&hkd); // icons TCHAR szModuleFileName[MAX_PATH]; if (GetModuleFileName(hInst, szModuleFileName, MAX_PATH)) addIcons(szModuleFileName); UnhookEvent(hModulesLoadedHook); usePopups = db_get_b(NULL, modname, "UsePopUps", 0); // Load the name order for (int i = 0; i < NAMEORDERCOUNT; i++) nameOrder[i] = i; DBVARIANT dbv; if (!db_get(NULL, "Contact", "NameOrder", &dbv)) { CopyMemory(nameOrder, dbv.pbVal, dbv.cpbVal); db_free(&dbv); } HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); if (bServiceMode) CallService("DBEditorpp/MenuCommand", 0, 0); return 0; }
int LoadHelpModule(void) { HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownHelpModule); CreateServiceFunction("Help/AboutCommand", AboutCommand); CreateServiceFunction("Help/IndexCommand", IndexCommand); CreateServiceFunction("Help/WebsiteCommand", WebsiteCommand); CreateServiceFunction("Help/BugCommand", BugCommand); CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("&Help"), 2000090000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "8824ECA5-6942-46D7-9D07-1BA600E0D02E"); SET_UID(mi, 0xf3ebf1fa, 0x587c, 0x494d, 0xbd, 0x33, 0x7f, 0x88, 0xb3, 0x61, 0x1e, 0xd3); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); mi.position = 2000090000; mi.name.a = LPGEN("&About..."); mi.pszService = "Help/AboutCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x495df66f, 0x844e, 0x479a, 0xaf, 0x21, 0x3e, 0x42, 0xc5, 0x14, 0x7c, 0x7e); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_HELP); mi.position = -500050000; mi.name.a = LPGEN("&Support"); mi.pszService = "Help/IndexCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x15e18b58, 0xec73, 0x45c2, 0xb9, 0xf4, 0x2a, 0xfe, 0xc2, 0xb7, 0xd3, 0x25); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDAWEB); mi.position = 2000050000; mi.name.a = LPGEN("&Miranda NG homepage"); mi.pszService = "Help/WebsiteCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xe7d0fe8b, 0xfdeb, 0x45b3, 0xba, 0x83, 0x3, 0x1e, 0x15, 0xda, 0x7e, 0x52); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL); mi.position = 2000040000; mi.name.a = LPGEN("&Report bug"); mi.pszService = "Help/BugCommand"; Menu_AddMainMenuItem(&mi); return 0; }
static INT_PTR InitMenu() { CLISTMENUITEM mi = {sizeof(mi)}; mi.flags = CMIM_ALL; mi.position = 100000000; mi.icolibItem = GetIconHandle(MENU_NAME); mi.pszPopupName = MENU_NAME; mi.pszService = SS_SERVICE_NAME; hSSMenuToggleOnOff = Menu_AddMainMenuItem(&mi); UpdateMenu(); return 0; }
HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, HGENMENU hRoot) { // TODO: support for unicode-core with unicode-aware CList CMenuItem mi; mi.name.t = (TCHAR*)pszName; mi.flags = flags | CMIF_TCHAR; mi.position = position; mi.hIcolibItem = hIcon; mi.pszService = const_cast<char*>(pszService); mi.root = hRoot; mi.uid = menu_id; menu_id.d[7]++; return Menu_AddMainMenuItem(&mi); }
void InitMainMenuItem() { CMenuItem mi(g_plugin); SET_UID(mi, 0x22b7b4db, 0xa9a1, 0x4d43, 0x88, 0x80, 0x4c, 0x23, 0x20, 0x31, 0xc6, 0xa0); mi.flags = CMIF_UNICODE; if (ServiceExists(MS_POPUP_ADDPOPUPT)) mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); mi.pszService = MS_STATUSCHANGE_MENUCOMMAND; hEnableDisableMenu = Menu_AddMainMenuItem(&mi); opt.TempDisabled = !opt.TempDisabled; EnableDisableMenuCommand(0, 0); }
HANDLE add_mainmenu(void) { CLISTMENUITEM mi = { 0 }; mi.cbSize = sizeof(mi); mi.position = -2000005000; mi.flags = CMIF_TCHAR; mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ADD)); mi.pszContactOwner = SKYPE_PROTONAME; mi.ptszName = LPGENT("Add Skype contact"); mi.pszService = SKYPE_ADDUSER; return Menu_AddMainMenuItem(&mi); }
void InitMenuItems(void) { bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 500010000, IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0)); CMenuItem mi; mi.flags = CMIF_TCHAR; mi.root = hMenuRoot; SET_UID(mi, 0x92c386ae, 0x6e81, 0x452d, 0xb5, 0x71, 0x87, 0x46, 0xe9, 0x2, 0x66, 0xe9); mi.hIcolibItem = IcoLib_GetIcon(ICO_HISTORY, 0); mi.pszService= MS_POPUP_SHOWHISTORY; mi.name.t = LPGENT("Popup History"); hMenuItemHistory = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x4353d44e, 0x177, 0x4843, 0x88, 0x30, 0x25, 0x5d, 0x91, 0xad, 0xdf, 0x3f); mi.hIcolibItem = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0); mi.pszService = "Popup/EnableDisableMenuCommand"; mi.name.t = (isEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups")); hMenuItem = Menu_AddMainMenuItem(&mi); }
int ModulesLoaded(WPARAM, LPARAM) { IcoLibRegister(); // Register menu item CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 1900000001); SET_UID(mi, 0xe298849c, 0x1a8c, 0x4fc7, 0xa0, 0xf4, 0x78, 0x18, 0xf, 0xe2, 0xf7, 0xc9); mi.position = 1900000001; mi.hIcolibItem = GetIcoLibHandle(ICO_DBE_BUTT); mi.name.a = modFullname; mi.pszService = "DBEditorpp/MenuCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x2fed8613, 0xac43, 0x4148, 0xbd, 0x5c, 0x44, 0x88, 0xaf, 0x68, 0x69, 0x10); mi.root = NULL; mi.hIcolibItem = GetIcoLibHandle(ICO_REGUSER); mi.name.a = LPGEN("Open user tree in DBE++"); mi.pszService = "DBEditorpp/MenuCommand"; hUserMenu = Menu_AddContactMenuItem(&mi); // Register hotkeys _A2T text(modFullname); HOTKEYDESC hkd = { sizeof(hkd) }; hkd.dwFlags = HKD_TCHAR; hkd.pszName = "hk_dbepp_open"; hkd.pszService = "DBEditorpp/MenuCommand"; hkd.ptszDescription = LPGENT("Open Database Editor"); hkd.ptszSection = text; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D'); Hotkey_Register(&hkd); g_bUsePopups = db_get_b(NULL, modname, "UsePopUps", 0) != 0; // Load the name order for (int i = 0; i < NAMEORDERCOUNT; i++) nameOrder[i] = i; DBVARIANT dbv = { 0 }; if (!db_get_s(NULL, "Contact", "NameOrder", &dbv, DBVT_BLOB)) { memcpy(nameOrder, dbv.pbVal, dbv.cpbVal); db_free(&dbv); } HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); if (g_bServiceMode) CallService("DBEditorpp/MenuCommand", 0, 0); return 0; }
void BossKeyMenuItemInit(void) // Add menu item { CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; mi.position = 2000100000; mi.pszPopupName = 0; mi.hIcon = Skin_GetIcon("hidemim"); mi.ptszName = LPGENT("Hide"); mi.pszService = MS_BOSSKEY_HIDE; g_hMenuItem = Menu_AddMainMenuItem(&mi); HookEvent(ME_CLIST_PREBUILDMAINMENU, GenMenuInit); }
int ModulesLoaded(WPARAM wParam, LPARAM lParam) { hShowGuide = CreateServiceFunction("UserGuide/ShowGuide", ShowGuideFile); CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 500000; mi.flags = CMIF_TCHAR; mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_HELP); mi.ptszName = LPGENT("User Guide"); mi.pszService = "UserGuide/ShowGuide"; Menu_AddMainMenuItem(&mi); return 0; }
extern "C" __declspec(dllexport) int Load() { mir_getLP(&pluginInfo); CMenuItem mi; CreateServiceFunction("TestPlug/MenuCommand", PluginMenuCommand); mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); mi.name.t = LPGENT("&Test Plugin..."); mi.pszService = "TestPlug/MenuCommand"; Menu_AddMainMenuItem(&mi); return 0; }
HANDLE addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName /* = NULL */, int popupPosition /* = 0 */, DWORD hotKey /* = 0 */) { // TODO: support for unicode-core with unicode-aware CList CLISTMENUITEM mi = { sizeof(mi) }; mi.ptszName = (TCHAR*)pszName; mi.flags = flags | CMIF_TCHAR; mi.position = position; mi.hIcon = hIcon; mi.pszService = const_cast<char*>(pszService); mi.ptszPopupName = (TCHAR*)pszPopupName; mi.popupPosition = popupPosition; mi.hotKey = hotKey; return Menu_AddMainMenuItem(&mi); }