Hello,
I have a function that will receive a Handle. That handle could be a pointer to a structure, or a object. Is there any safe way to discover it's nature?
The following code will work when the Handle is an Object or nil, but will crash the application when the Handle is a structure:
function TQtWidgetSet.IsValidGDIObject(const GDIObject: HGDIOBJ): Boolean;
var
aObject: TObject;
begin
Result := False;
if GDIObject = 0 then Exit;
aObject := TObject(GDIObject);
if aObject is TObject then
begin
Result := (aObject is TQtFont) or (aObject is TQtBrush);
end;
end;thanks,
