OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/win_util.h" | 5 #include "base/win_util.h" |
6 | 6 |
7 #include <sddl.h> | 7 #include <sddl.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/registry.h" | 10 #include "base/registry.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 bool IsSubclassed(HWND window, WNDPROC subclass_proc) { | 272 bool IsSubclassed(HWND window, WNDPROC subclass_proc) { |
273 WNDPROC original_handler = | 273 WNDPROC original_handler = |
274 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); | 274 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); |
275 return original_handler == subclass_proc; | 275 return original_handler == subclass_proc; |
276 } | 276 } |
277 | 277 |
278 bool Subclass(HWND window, WNDPROC subclass_proc) { | 278 bool Subclass(HWND window, WNDPROC subclass_proc) { |
279 WNDPROC original_handler = | 279 WNDPROC original_handler = |
280 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); | 280 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); |
281 if (original_handler != subclass_proc) { | 281 if (original_handler != subclass_proc) { |
282 DCHECK(!GetProp(window, kHandlerKey)) << "subclassing a HWND more than " | |
283 "once"; | |
284 win_util::SetWindowProc(window, subclass_proc); | 282 win_util::SetWindowProc(window, subclass_proc); |
285 SetProp(window, kHandlerKey, original_handler); | 283 SetProp(window, kHandlerKey, original_handler); |
286 return true; | 284 return true; |
287 } | 285 } |
288 return false; | 286 return false; |
289 } | 287 } |
290 | 288 |
291 bool Unsubclass(HWND window, WNDPROC subclass_proc) { | 289 bool Unsubclass(HWND window, WNDPROC subclass_proc) { |
292 WNDPROC current_handler = | 290 WNDPROC current_handler = |
293 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); | 291 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 389 |
392 #ifndef COPY_FILE_COPY_SYMLINK | 390 #ifndef COPY_FILE_COPY_SYMLINK |
393 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 391 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
394 set it as your default include path to build this library. You can grab it by \ | 392 set it as your default include path to build this library. You can grab it by \ |
395 searching for "download windows sdk 2008" in your favorite web search engine. \ | 393 searching for "download windows sdk 2008" in your favorite web search engine. \ |
396 Also make sure you register the SDK with Visual Studio, by selecting \ | 394 Also make sure you register the SDK with Visual Studio, by selecting \ |
397 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 395 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
398 menu (see Start - All Programs - Microsoft Windows SDK - \ | 396 menu (see Start - All Programs - Microsoft Windows SDK - \ |
399 Visual Studio Registration). | 397 Visual Studio Registration). |
400 #endif | 398 #endif |
OLD | NEW |