static bool RegisterWinClass() { WNDCLASSEX wcex; ATOM atom; FillWndClassEx(wcex, FRAME_CLASS_NAME, WndProcFrame); wcex.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SUMATRAPDF)); CrashIf(!wcex.hIcon); // For the extended translucent frame to be visible, we need black background. wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); atom = RegisterClassEx(&wcex); CrashIf(!atom); FillWndClassEx(wcex, CANVAS_CLASS_NAME, WndProcCanvas); wcex.style |= CS_DBLCLKS; atom = RegisterClassEx(&wcex); CrashIf(!atom); FillWndClassEx(wcex, PROPERTIES_CLASS_NAME, WndProcProperties); wcex.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SUMATRAPDF)); CrashIf(!wcex.hIcon); atom = RegisterClassEx(&wcex); CrashIf(!atom); RegisterNotificationsWndClass(); RegisterSplitterWndClass(); RegisterLabelWithCloseWnd(); RegisterCaptionWndClass(); return true; }
static bool RegisterWinClass(HINSTANCE hinst) { WNDCLASSEX wcex; ATOM atom; FillWndClassEx(wcex, hinst, FRAME_CLASS_NAME, WndProcFrame); wcex.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_SUMATRAPDF)); atom = RegisterClassEx(&wcex); CrashIf(!atom); FillWndClassEx(wcex, hinst, CANVAS_CLASS_NAME, WndProcCanvas); wcex.style |= CS_DBLCLKS; atom = RegisterClassEx(&wcex); CrashIf(!atom); FillWndClassEx(wcex, hinst, PROPERTIES_CLASS_NAME, WndProcProperties); wcex.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_SUMATRAPDF)); atom = RegisterClassEx(&wcex); CrashIf(!atom); FillWndClassEx(wcex, hinst, SIDEBAR_SPLITTER_CLASS_NAME, WndProcSidebarSplitter); wcex.hCursor = LoadCursor(NULL, IDC_SIZEWE); wcex.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); atom = RegisterClassEx(&wcex); CrashIf(!atom); FillWndClassEx(wcex, hinst, FAV_SPLITTER_CLASS_NAME, WndProcFavSplitter); wcex.hCursor = LoadCursor(NULL, IDC_SIZENS); wcex.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); atom = RegisterClassEx(&wcex); CrashIf(!atom); RegisterNotificationsWndClass(hinst); RegisterMobiWinClass(hinst); return true; }
static bool RegisterWinClass(HINSTANCE hinst) { WNDCLASSEX wcex; ATOM atom; FillWndClassEx(wcex, hinst); wcex.lpfnWndProc = WndProcFrame; wcex.lpszClassName = FRAME_CLASS_NAME; wcex.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_SUMATRAPDF)); wcex.hIconSm = LoadIcon(hinst, MAKEINTRESOURCE(IDI_SMALL)); atom = RegisterClassEx(&wcex); if (!atom) return false; FillWndClassEx(wcex, hinst); wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wcex.lpfnWndProc = WndProcCanvas; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.lpszClassName = CANVAS_CLASS_NAME; atom = RegisterClassEx(&wcex); if (!atom) return false; FillWndClassEx(wcex, hinst); wcex.lpfnWndProc = WndProcAbout; wcex.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_SUMATRAPDF)); wcex.lpszClassName = ABOUT_CLASS_NAME; atom = RegisterClassEx(&wcex); if (!atom) return false; FillWndClassEx(wcex, hinst); wcex.lpfnWndProc = WndProcProperties; wcex.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_SUMATRAPDF)); wcex.lpszClassName = PROPERTIES_CLASS_NAME; atom = RegisterClassEx(&wcex); if (!atom) return false; FillWndClassEx(wcex, hinst); wcex.lpfnWndProc = WndProcSidebarSplitter; wcex.hCursor = LoadCursor(NULL, IDC_SIZEWE); wcex.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wcex.lpszClassName = SIDEBAR_SPLITTER_CLASS_NAME; atom = RegisterClassEx(&wcex); if (!atom) return false; FillWndClassEx(wcex, hinst); wcex.lpfnWndProc = WndProcFavSplitter; wcex.hCursor = LoadCursor(NULL, IDC_SIZENS); wcex.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wcex.lpszClassName = FAV_SPLITTER_CLASS_NAME; atom = RegisterClassEx(&wcex); if (!atom) return false; if (!RegisterNotificationsWndClass(hinst)) return false; if (!RegisterMobiWinClass(hinst)) return false; return true; }