diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 20:38:18 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 20:38:18 +0000 |
commit | 7a66b99fbf5cd967ba12e643fc0072fc20514990 (patch) | |
tree | d4bec32782951f4c63a4aca99b655222017c6002 /content/browser/system_message_window_win.cc | |
parent | decd4114476cb68ef734dd91cbea6d56c404bee5 (diff) | |
download | chromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.zip chromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.tar.gz chromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.tar.bz2 |
Added base::win::InitializeWindowClass() wrapper to make sure that window classes are properly associated with the modules containing their window procedures.
TEST=win,win_rel
Review URL: https://chromiumcodereview.appspot.com/10315012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/system_message_window_win.cc')
-rw-r--r-- | content/browser/system_message_window_win.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/content/browser/system_message_window_win.cc b/content/browser/system_message_window_win.cc index 347e717d..1f6fcb0 100644 --- a/content/browser/system_message_window_win.cc +++ b/content/browser/system_message_window_win.cc @@ -15,26 +15,25 @@ static const wchar_t* const WindowClassName = L"Chrome_SystemMessageWindow"; SystemMessageWindowWin::SystemMessageWindowWin() { - HINSTANCE hinst = GetModuleHandle(NULL); - - WNDCLASSEX wc = {0}; - wc.cbSize = sizeof(wc); - wc.lpfnWndProc = - base::win::WrappedWindowProc<&SystemMessageWindowWin::WndProcThunk>; - wc.hInstance = hinst; - wc.lpszClassName = WindowClassName; - ATOM clazz = RegisterClassEx(&wc); + WNDCLASSEX window_class; + base::win::InitializeWindowClass( + WindowClassName, + &base::win::WrappedWindowProc<SystemMessageWindowWin::WndProcThunk>, + 0, 0, 0, NULL, NULL, NULL, NULL, NULL, + &window_class); + instance_ = window_class.hInstance; + ATOM clazz = RegisterClassEx(&window_class); DCHECK(clazz); window_ = CreateWindow(WindowClassName, - 0, 0, 0, 0, 0, 0, 0, 0, hinst, 0); + 0, 0, 0, 0, 0, 0, 0, 0, instance_, 0); SetWindowLongPtr(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); } SystemMessageWindowWin::~SystemMessageWindowWin() { if (window_) { DestroyWindow(window_); - UnregisterClass(WindowClassName, GetModuleHandle(NULL)); + UnregisterClass(WindowClassName, instance_); } } |