summaryrefslogtreecommitdiffstats
path: root/ui/base/win
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-13 04:06:24 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-13 04:06:24 +0000
commit831de724f3aed4700bb20750e2434b4159f485da (patch)
tree0486914d3c088ad770927700fd606a93176c562a /ui/base/win
parent340eab6c6cf8009fdad6275d44ca06eeedea7565 (diff)
downloadchromium_src-831de724f3aed4700bb20750e2434b4159f485da.zip
chromium_src-831de724f3aed4700bb20750e2434b4159f485da.tar.gz
chromium_src-831de724f3aed4700bb20750e2434b4159f485da.tar.bz2
Adds yet more debugging code.
BUG=77651 TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/6834006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81363 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/win')
-rw-r--r--ui/base/win/window_impl.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/ui/base/win/window_impl.cc b/ui/base/win/window_impl.cc
index 0f48b89..1d2c55b 100644
--- a/ui/base/win/window_impl.cc
+++ b/ui/base/win/window_impl.cc
@@ -144,10 +144,27 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) {
height = bounds.height();
}
- hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), NULL,
+ std::wstring name(GetWindowClassName());
+ hwnd_ = CreateWindowEx(window_ex_style_, name.c_str(), NULL,
window_style_, x, y, width, height,
parent, NULL, NULL, this);
- CHECK(hwnd_);
+ if (!hwnd_) {
+ LPWSTR error_string = NULL;
+ DWORD last_error = GetLastError();
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ 0, // Use the internal message table.
+ last_error,
+ 0, // Use default language.
+ reinterpret_cast<LPWSTR>(&error_string),
+ 0, // Buffer size.
+ 0); // Arguments (unused).
+ CHECK(false) << "Create failed error=" << last_error <<
+ " message=" << error_string << " name=" << name << " style=" <<
+ window_style_ << " ex_style=" << window_ex_style_;
+ if (error_string)
+ LocalFree(error_string);
+ }
// The window procedure should have set the data for us.
CHECK_EQ(this, ui::GetWindowUserData(hwnd_));