INT_PTR OnEventFire(WPARAM wParam, LPARAM) { CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0); CloseHandle((HANDLE)wParam); HWND parent = pcli->hwndContactList; if (parent == NULL) // no clist, no buttons return -1; WNDCLASS wndclass = {0}; wndclass.lpfnWndProc = TopToolBarProc; wndclass.cbWndExtra = sizeof(void *); wndclass.hInstance = hInst; wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndclass.lpszClassName = pluginname; RegisterClass(&wndclass); g_ctrl->pButtonList = (SortedList *)&Buttons; g_ctrl->hWnd = CreateWindow(pluginname, _T("Toolbar"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, g_ctrl->nLastHeight, parent, NULL, hInst, NULL); SetWindowLongPtr(g_ctrl->hWnd, 0, (LONG_PTR)g_ctrl); LoadBackgroundOptions(); // if we're working in skinned clist, receive the standard buttons & customizations if (g_CustomProc && g_ctrl->hWnd) g_CustomProc(TTB_WINDOW_HANDLE, g_ctrl->hWnd, g_CustomProcParam); else InitInternalButtons(); // if there's no customized frames, create our own if (g_ctrl->hFrame == NULL) { CLISTFrame Frame = { sizeof(Frame) }; Frame.tname = _T("Toolbar"); Frame.hWnd = g_ctrl->hWnd; Frame.align = alTop; Frame.Flags = F_VISIBLE | F_NOBORDER | F_LOCKED | F_TCHAR; Frame.height = g_ctrl->nLastHeight; Frame.hIcon = Skin_LoadIcon(SKINICON_OTHER_FRAME); g_ctrl->hFrame = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0); } // receive buttons NotifyEventHooks(hTTBModuleLoaded, 0, 0); return 0; }
static int OnBGChange(WPARAM, LPARAM) { LoadBackgroundOptions(); return 0; }