diff options
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 38 |
1 files changed, 15 insertions, 23 deletions
@@ -43,7 +43,6 @@ char g_szLimitScreenwriter[64]; static LRESULT CALLBACK CBTProc(int, WPARAM, LPARAM); static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); static INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM); -static HWND CreateStatusBar(HWND, HINSTANCE); static void UpdateTheme(); void OnTerminate() @@ -124,7 +123,16 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, cons if (!hHook) throw Win32Error(GetLastError()); if (!hWnd) throw Win32Error(GetLastError()); UnhookWindowsHookEx(hHook); - g_hWndStatus = CreateStatusBar(hWnd, hInstance); + + g_hWndStatus = CreateWindowEx( + 0, + STATUSCLASSNAME, + (const TCHAR*)NULL, + WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP, + 0, 0, 0, 0, + hWnd, (HMENU)ID_STATUS, hInstance, NULL + ); + ShowWindow(hWnd, nCmdShow); /* Populate episode list view. */ @@ -148,7 +156,7 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR if (nCode < 0 || nCode != HCBT_CREATEWND || g_hWnd) return CallNextHookEx(0, nCode, wParam, lParam); - /* This code is run once at the creation of the top-level + /* This code is run ONCE, at the creation of the top-level * window -- before WndProc! This is important, as it * initializes global variables that are used by WndProc. */ @@ -196,7 +204,6 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, { switch (uMsg) { case WM_CREATE: - { UpdateTheme(); SetWindowPos(hWnd, NULL, -1, -1, Dpi(510), Dpi(400), SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE); SetFocus(g_pElv->hWnd); @@ -209,7 +216,6 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, g_szLimitScreenwriter[0]? MF_UNCHECKED: MF_CHECKED); break; - } case WM_CLOSE: DestroyWindow(hWnd); break; @@ -476,6 +482,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, return 0; } +/* Handle messages to Help > About dialog. */ INT_PTR CALLBACK AboutDlgProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM) { switch (uMsg) { @@ -496,23 +503,6 @@ INT_PTR CALLBACK AboutDlgProc(const HWND hWnd, const UINT uMsg, const WPARAM wPa return TRUE; } -HWND CreateStatusBar(const HWND hWndParent, const HINSTANCE hInstance) -{ - return CreateWindowEx( - 0, - STATUSCLASSNAME, - (const TCHAR*)NULL, - WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP, - 0, 0, 0, 0, - hWndParent, - (HMENU)ID_STATUS, - hInstance, - NULL - ); -} - -/***/ - void UpdateLayout() { int cxColumn, cyDlv, yStatus; @@ -523,9 +513,10 @@ void UpdateLayout() GetClientRect(g_hWndStatus, &rcStatus); yStatus = rcStatus.bottom-rcStatus.top; - /* Resize data list view. */ SendMessage(g_pDlv->hWnd, WM_SETREDRAW, FALSE, 0); SendMessage(g_pElv->hWnd, WM_SETREDRAW, FALSE, 0); + + /* Resize data list view. */ cyDlv = rc.bottom-yStatus-g_pDlv->Height(); MoveWindow(g_pDlv->hWnd, 0, cyDlv, rc.right, rc.bottom-yStatus-cyDlv, TRUE); ListView_SetColumnWidth(g_pDlv->hWnd, DLVSIKEY, LVSCW_AUTOSIZE); @@ -540,6 +531,7 @@ void UpdateLayout() ListView_SetColumnWidth(g_pElv->hWnd, ELVSIEPISODE, cxColumn); cxColumn += ListView_GetColumnWidth(g_pElv->hWnd, ELVSIRATING); ListView_SetColumnWidth(g_pElv->hWnd, ELVSITITLE, rc.right-cxColumn-cxVScroll-4); + SendMessage(g_pElv->hWnd, WM_SETREDRAW, TRUE, 0); SendMessage(g_pDlv->hWnd, WM_SETREDRAW, TRUE, 0); |