diff options
Diffstat (limited to 'popup/src/main.cpp')
-rw-r--r-- | popup/src/main.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/popup/src/main.cpp b/popup/src/main.cpp index 94d8b6f..486c597 100644 --- a/popup/src/main.cpp +++ b/popup/src/main.cpp @@ -72,6 +72,12 @@ HANDLE hMenuRoot = NULL; HANDLE hMenuItem = NULL;
HANDLE hMenuItemHistory = NULL;
+//==== ServiceFunctions Handles ====
+HANDLE hShowHistory = NULL;
+HANDLE hTogglePopup = NULL;
+HANDLE hGetStatus = NULL;
+HANDLE hGetVersion = NULL;
+
//===== Event Handles =====
HANDLE hOptionsInitialize;
//HANDLE hNotifyOptionsInitialize; deprecatet
@@ -319,13 +325,13 @@ void InitMenuItems(void) { // Add item to main menu
mi.hParentMenu = (HGENMENU)hMenuRoot;
- CreateServiceFunction(MENUCOMMAND_SVC, svcEnableDisableMenuCommand);
+ hTogglePopup = CreateServiceFunction(MENUCOMMAND_SVC, svcEnableDisableMenuCommand);
mi.ptszName = PopUpOptions.ModuleIsEnabled ? LPGENT("Disable &popup module") : LPGENT("Enable &popup module");
mi.pszService = MENUCOMMAND_SVC;
hMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi);
// Popup History
- CreateServiceFunction(MENUCOMMAND_HISTORY, svcShowHistory);
+ hShowHistory = CreateServiceFunction(MENUCOMMAND_HISTORY, svcShowHistory);
mi.position = 1000000000;
mi.popupPosition = 1999990000;
mi.ptszName = LPGENT("Popup History");
@@ -368,14 +374,14 @@ void registerUpdate(){ //register Hotkey
void LoadHotkey(){
- HOTKEYDESC * hk = new HOTKEYDESC;
- ZeroMemory(hk, sizeof(HOTKEYDESC));
- hk->cbSize = sizeof(hk);
- hk->pszName = Translate("Toggle Popups");
- hk->pszDescription = Translate("Toggle Popups");
- hk->pszSection = Translate(MODULNAME_PLU);
- hk->pszService = MENUCOMMAND_SVC;
- CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) hk);
+ HOTKEYDESC hk = {0};
+ hk.cbSize = sizeof(hk);
+ hk.dwFlags = HKD_TCHAR;
+ hk.pszName = "Toggle Popups";
+ hk.ptszDescription = LPGENT("Toggle Popups");
+ hk.ptszSection = LPGENT(MODULNAME_PLU);
+ hk.pszService = MENUCOMMAND_SVC;
+ CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &hk);
}
//menu
@@ -544,8 +550,8 @@ MIRAPI int Load(PLUGINLINK *link) CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(ver), (LPARAM) ver);
g_popup.isMirUnicode = strstr(ver, "Unicode") != NULL;
- CreateServiceFunction("PopupPlus/GetVersion", svcGetVersion);
- CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus);
+ hGetVersion = CreateServiceFunction("PopupPlus/GetVersion", svcGetVersion);
+ hGetStatus = CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus);
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0);
@@ -708,6 +714,13 @@ MIRAPI int Unload(void) UnhookEvent(hEventStatusChanged);
UnhookEvent(hIconsChanged);
UnhookEvent(hFontsChanged);
+ UnhookEvent(hTBLoaded);
+
+ DestroyServiceFunction(hShowHistory);
+ DestroyServiceFunction(hTogglePopup);
+ DestroyServiceFunction(hGetStatus);
+ DestroyServiceFunction(hGetVersion);
+ DestroyServiceFunction(hSquareFad);
DeleteObject(fonts.title);
DeleteObject(fonts.clock);
@@ -728,6 +741,7 @@ MIRAPI int Unload(void) OptAdv_UnregisterVfx();
UnloadPopupThread();
+ UnloadPopupWnd2();
PopupHistoryUnload();
UnregisterClass (MAKEINTATOM(g_wndClass.cPopupWnd2),hInst);
|