diff --git a/lcl/interfaces/win32/win32wscomctrls.pp b/lcl/interfaces/win32/win32wscomctrls.pp index 13c7528381..d13528d6e1 100644 --- a/lcl/interfaces/win32/win32wscomctrls.pp +++ b/lcl/interfaces/win32/win32wscomctrls.pp @@ -294,12 +294,19 @@ var Parent: HWND; PreferredSizeStatusBar: HWND; R: TRect; + AErrorCode: Cardinal; begin Flags := WS_CHILD or WS_CLIPSIBLINGS or WS_CLIPCHILDREN; Parent := TWin32WidgetSet(WidgetSet).AppHandle; PreferredSizeStatusBar := CreateWindowExW(0, STATUSCLASSNAMEW, nil, Flags, 0, 0, 0, 0, Parent, 0, HInstance, nil); + if PreferredSizeStatusBar = 0 then + begin + AErrorCode := GetLastError; + DebugLn(['Failed to create win32 control, error: ', AErrorCode, ' : ', GetLastErrorText(AErrorCode)]); + raise Exception.Create('Failed to create win32 control, error: ' + IntToStr(AErrorCode) + ' : ' + GetLastErrorText(AErrorCode)); + end; GetWindowRect(PreferredSizeStatusBar, R); PreferredStatusBarHeight := R.Bottom - R.Top; DestroyWindow(PreferredSizeStatusBar);