Qt: TQtWidgetSet.GetDC() check if hwnd is valid handle.

git-svn-id: trunk@30541 -
This commit is contained in:
zeljko 2011-05-03 14:33:23 +00:00
parent fc8550cf53
commit 0abaa5be8e

View File

@ -2268,18 +2268,14 @@ begin
WriteLn('Trace:> [WinAPI GetDC] hWnd: ', dbghex(hWnd)); WriteLn('Trace:> [WinAPI GetDC] hWnd: ', dbghex(hWnd));
{$endif} {$endif}
Widget := TQtWidget(hWnd); if QtWidgetSet.IsValidHandle(hWnd) then
if Widget <> nil then
begin begin
Widget := TQtWidget(hWnd);
Result := Widget.Context; Result := Widget.Context;
if Result = 0 then if Result = 0 then
Result := HDC(QtDefaultContext); Result := HDC(QtDefaultContext);
end end else
else
begin
Result := HDC(QtScreenContext); Result := HDC(QtScreenContext);
end;
{$ifdef VerboseQtWinAPI} {$ifdef VerboseQtWinAPI}
WriteLn('Trace:< [WinAPI GetDC] Result: ', dbghex(Result)); WriteLn('Trace:< [WinAPI GetDC] Result: ', dbghex(Result));