solve problem with null HWND in OOP implementation