1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #ifndef BASE_WIN_WRAPPED_WINDOW_PROC_H_
- #define BASE_WIN_WRAPPED_WINDOW_PROC_H_
- #include <windows.h>
- #include "base/base_export.h"
- namespace base {
- namespace win {
- using WinProcExceptionFilter = int __cdecl (*)(EXCEPTION_POINTERS* info);
- BASE_EXPORT WinProcExceptionFilter
- SetWinProcExceptionFilter(WinProcExceptionFilter filter);
- BASE_EXPORT int CallExceptionFilter(EXCEPTION_POINTERS* info);
- BASE_EXPORT void InitializeWindowClass(const wchar_t* class_name,
- WNDPROC window_proc,
- UINT style,
- int class_extra,
- int window_extra,
- HCURSOR cursor,
- HBRUSH background,
- const wchar_t* menu_name,
- HICON large_icon,
- HICON small_icon,
- WNDCLASSEX* class_out);
- template <WNDPROC proc>
- LRESULT CALLBACK
- WrappedWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
- LRESULT rv = 0;
- __try {
- rv = proc(hwnd, message, wparam, lparam);
- } __except (CallExceptionFilter(GetExceptionInformation())) {
- }
- return rv;
- }
- }
- }
- #endif
|