diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-14 02:34:42 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-14 02:34:42 +0200 |
commit | 26f70ab37bee8ffd70b662ff999613c643215605 (patch) | |
tree | 88f03e76a52675b2e3e18f5d4d5966188e4b2eaf /c/listview.cpp | |
parent | 8122c83bb3be30325f49d50dbafcd2f14c9b0d2e (diff) | |
download | EpisodeBrowser-26f70ab37bee8ffd70b662ff999613c643215605.tar.gz |
Initialize global variables in the right place.
The rules for what messages are sent at window creation -- and in
which order -- are neither intuitive or clear. WM_CREATE can NOT be
relied upon to initialize global state required by handlers of other
messages (such as WM_GETMINMAXINFO, which seems to be sent before
WM_CREATE).
Thus, the better solution is to initialize everything using a CBT hook
before the window procedure is even run. Because CBTProc creates
(child): windows of its own, though, one must be careful to only run
the initialization once, which is done by checking g_hWnd.
Diffstat (limited to 'c/listview.cpp')
-rw-r--r-- | c/listview.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/c/listview.cpp b/c/listview.cpp index 09a3024..8e92ea1 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -9,8 +9,7 @@ extern HFONT g_hfNormal; extern HWND g_hWnd; static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); -void -ListView::Create(HMENU hMenu, DWORD dwStyle) +ListView::ListView(HMENU hMenu, DWORD dwStyle) { m_hWnd = CreateWindowEx( WS_EX_CLIENTEDGE, |