From f5cb25824d8c48b0d79ac7ebc1726d135d8f1966 Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Tue, 25 Nov 2008 21:10:32 +0000 Subject: Review URL: http://codereview.chromium.org/12434 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5990 0039d316-1c4b-4281-b951-d872f2087c98 --- base/win_util.cc | 6 ++++++ base/win_util.h | 3 +++ 2 files changed, 9 insertions(+) (limited to 'base') diff --git a/base/win_util.cc b/base/win_util.cc index 37c5075..cfd7f2b 100644 --- a/base/win_util.cc +++ b/base/win_util.cc @@ -257,6 +257,12 @@ void* GetWindowUserData(HWND hwnd) { // installed. static const wchar_t* const kHandlerKey = L"__ORIGINAL_MESSAGE_HANDLER__"; +bool IsSubclassed(HWND window, WNDPROC subclass_proc) { + WNDPROC original_handler = + reinterpret_cast(GetWindowLongPtr(window, GWLP_WNDPROC)); + return original_handler == subclass_proc; +} + bool Subclass(HWND window, WNDPROC subclass_proc) { WNDPROC original_handler = reinterpret_cast(GetWindowLongPtr(window, GWLP_WNDPROC)); diff --git a/base/win_util.h b/base/win_util.h index 2165e62..317c332 100644 --- a/base/win_util.h +++ b/base/win_util.h @@ -50,6 +50,9 @@ bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor); // Useful for subclassing a HWND. Returns the previous window procedure. WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); +// Returns true if the existing window procedure is the same as |subclass_proc|. +bool IsSubclassed(HWND window, WNDPROC subclass_proc); + // Subclasses a window, replacing its existing window procedure with the // specified one. Returns true if the current window procedure was replaced, // false if the window has already been subclassed with the specified -- cgit v1.1