#include <dblbuf.h>
Public Member Functions | |
_DoubleBufferedControlHook (HBRUSH hBackBrush) | |
Creates the double-buffer hook control with a background brush. | |
_DoubleBufferedControlHook (ULONG SystemColor=COLOR_BTNFACE) | |
~_DoubleBufferedControlHook () | |
bool | HookControl (HWND hWnd) |
Performs actual control hooking. | |
Static Private Member Functions | |
static LRESULT CALLBACK | NewWindowProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) |
Overrides the window proc for the hooked control. | |
Private Attributes | |
WNDPROC | m_OldWindowProc |
HBRUSH | m_hBackBrush |
This class allows using standard GDI controls, such as list views, in a double-buffered mode. That approach completely removes flickering on fast information update for these controls. You should never use the _DoubleBufferedControlHook directly. Instead use the DoubleBufferedControlHook or one of the specialized clases, such as DoubleBufferedStaticText:
class WindowClass { ... DoubleBufferedControlHook m_Hook; ...
OnCreate(...) //Or OnInitDialog() { ... m_Hook.HookControl(GetDlgItem(...)); // ---OR--- m_Hook.HookControl(m_hwndSomeControl); }
}
_CallWindowProc | allows specifying user-defined function that calls the original window procedure, performing some additional filtering, if required. By default, this parameter is set to CallWindowProc function provided by Windows. See the DoubleBufferedStaticText implementation for usage example |
BazisLib::Win32::_DoubleBufferedControlHook<>::_DoubleBufferedControlHook | ( | HBRUSH | hBackBrush | ) | [inline] |
Creates the double-buffer hook control with a background brush.
As we ignore the WM_ERASEBKGND message and do all the erasing inside WM_PAINT, the background color or brush should be known to our override class. Use either this constructor, or the constructor taking a system color reference to specify it.
BazisLib::Win32::_DoubleBufferedControlHook<>::_DoubleBufferedControlHook | ( | ULONG | SystemColor = COLOR_BTNFACE |
) | [inline] |
BazisLib::Win32::_DoubleBufferedControlHook<>::~_DoubleBufferedControlHook | ( | ) | [inline] |
bool BazisLib::Win32::_DoubleBufferedControlHook<>::HookControl | ( | HWND | hWnd | ) | [inline] |
Performs actual control hooking.
This method should be called after the control that is to be hooked was created.
hWnd | Specifies the window handle for the control to hook. |
static LRESULT CALLBACK BazisLib::Win32::_DoubleBufferedControlHook<>::NewWindowProc | ( | HWND | hWnd, | |
UINT | wMsg, | |||
WPARAM | wParam, | |||
LPARAM | lParam | |||
) | [inline, static, private] |
Overrides the window proc for the hooked control.
This static method is called each time a message is sent to the hooked control. It actually handles only two messages: WM_ERASEBKGND and WM_PAINT. All other messages are simply forwarded to the original message function. For the WM_ERASEBKGND no work is performed, and WM_PAINT handler creates a temporary bitmap, invokes the original window procedure with it, and then copies the bitmap to the original DC.
HBRUSH BazisLib::Win32::_DoubleBufferedControlHook<>::m_hBackBrush [private] |
WNDPROC BazisLib::Win32::_DoubleBufferedControlHook<>::m_OldWindowProc [private] |