Jump to content

maXcomX

Members
  • Content Count

    34
  • Joined

  • Last visited

Everything posted by maXcomX

  1. maXcomX

    Why does CoInitializeEx returns 1 or $80010106 ?

    Here a sample to reproduce the issue. TestCoIntitialize.zip
  2. maXcomX

    Why does CoInitializeEx returns 1 or $80010106 ?

    I did read the info from ms docs you mentioned, thank you. But I can't understand what this have to do with starting a clean Delphi app calling OnCreateForm give this results while there is nothing initiated before. For example: Creating a new vcl app with just one form and declaring CoInitializeEx on OnFormCreate and CoUninitialize() on FormCloseQuery. When debugging CoInitializeEx produces the results I mentioned at the start of this thread.
  3. maXcomX

    Why does CoInitializeEx returns 1 or $80010106 ?

    Oops, I edited the question for some more clarification. Sorry Remy.
  4. maXcomX

    COM: OleCheck() in polling

    Why does a call to CoInitializeEx(nil, COINIT_APARTMENTTHREADED or COINIT_DISABLE_OLE1DDE); always returns 1 instead of 0 (S_OK)?
  5. Why is CPPFreeAndNil declared in sysutils delphi 10.4 ?
  6. maXcomX

    Translation of C headers.

    The same issue.
  7. maXcomX

    Translation of C headers.

    Well after I had a discussion with Microsoft, we came to some conclusions:First of all: The original declaration of ID2D1SvgElement is probably correct!Changing the method order results in multiple errors using the original Microsoft D2DSvgImage sample (with some changes concerning the use of inline functions).The problem probably hints to a wrong D2D1 initialization sequence.For instance: SetAttributeValue should be called before GetAttributeValue at any time!If nothing is set there is nothing to get! And therefore results to a Nil and hresult is 'The parameter is incorrect.' If you want a color, you shuold use the ID2D1SvgPaint interface to retrieve a color, not ID2D1SvgElement.GetAttributeValue!We did an experiment to alter the header as suggested by Pyscripter and run it in VS2019.. Well, that wented out to be a disaster: The MS sample did not work anymore.Most likely the thing is: The Delphi samples (about svg here) are bogus.We wil investigate this issue further on, but until now it points to a wrong usage/implenentation of D2D1. About the Vtable: The correct Vtable should be showed in memory, not by decompiling a dll.
  8. maXcomX

    Translation of C headers.

    @pyscripter Did you run the original example from Microsoft in Visual Studio?
  9. Well.. I'm affraid the Interface ID2D1SvgElement declaration is not correct. And a reason why it it doesn't work as expected by the latest SDK. This the complete interface according to SDK 10.0.19041.0. type // Interface ID2D1SvgElement // ========================= // Interface for all SVG elements. // {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1SvgElement);'} {$EXTERNALSYM ID2D1SvgElement} ID2D1SvgElement = interface(ID2D1Resource) ['{ac7b67a6-183e-49c1-a823-0ebe40b0db29}'] // Gets the document that contains this element. Returns nil if the element has // been removed from the tree. procedure GetDocument(document: ID2D1SvgDocument); stdcall; {$EXTERNALSYM GetDocument} // Gets the tag name. function GetTagName(out name: PWideChar; nameCount: UINT32): HResult; stdcall; {$EXTERNALSYM GetTagName} // Gets the string length of the tag name. The returned string length does not // include room for the null terminator. function GetTagNameLength(): UINT32; stdcall; {$EXTERNALSYM GetTagNameLength} // Returns TRUE if this element represents text content, e.g. the content of a // 'title' or 'desc' element. Text content does not have a tag name. function IsTextContent(): BOOL; stdcall; {$EXTERNALSYM IsTextContent} // Gets the parent element. procedure GetParent(out parent: ID2D1SvgElement); stdcall; {$EXTERNALSYM GetParent} // Returns whether this element has children. function HasChildren(): BOOL; stdcall; {$EXTERNALSYM HasChildren} // Gets the first child of this element. procedure GetFirstChild(out child: ID2D1SvgElement); stdcall; {$EXTERNALSYM GetFirstChild} // Gets the last child of this element. procedure GetLastChild(out child: ID2D1SvgElement); stdcall; {$EXTERNALSYM GetLastChild} // Gets the previous sibling of the referenceChild element. // <param name="referenceChild">The referenceChild must be an immediate child of // this element.</param> // <param name="previousChild">The output previousChild element will be non-nil if // the referenceChild has a previous sibling. If the referenceChild is the first // child, the output is nil.</param> function GetPreviousChild(const referenceChild: ID2D1SvgElement; out previousChild: ID2D1SvgElement): HResult; stdcall; {$EXTERNALSYM GetPreviousChild} // Gets the next sibling of the referenceChild element. // <param name="referenceChild">The referenceChild must be an immediate child of // this element.</param> // <param name="nextChild">The output nextChild element will be non-nil if the // referenceChild has a next sibling. If the referenceChild is the last child, the // output is nil.</param> function GetNextChild(const referenceChild: ID2D1SvgElement; out nextChild: ID2D1SvgElement): HResult; stdcall; {$EXTERNALSYM GetNextChild} // Inserts newChild as a child of this element, before the referenceChild element. // If the newChild element already has a parent, it is removed from this parent as // part of the insertion. Returns an error if this element cannot accept children // of the type of newChild. Returns an error if the newChild is an ancestor of this // element. // <param name="newChild">The element to be inserted.</param> // <param name="referenceChild">The element that the child should be inserted // before. If referenceChild is nil, the newChild is placed as the last child. If // referenceChild is non-nil, it must be an immediate child of this element. // </param> function InsertChildBefore(newChild: ID2D1SvgElement; {In_opt} referenceChild: PID2D1SvgElement = Nil): HResult; stdcall; {$EXTERNALSYM InsertChildBefore} // Appends newChild to the list of children. If the newChild element already has a // parent, it is removed from this parent as part of the append operation. Returns // an error if this element cannot accept children of the type of newChild. Returns // an error if the newChild is an ancestor of this element. // <param name="newChild">The element to be appended.</param> function AppendChild(newChild: ID2D1SvgElement): HResult; stdcall; {$EXTERNALSYM AppendChild} // Replaces the oldChild element with the newChild. This operation removes the // oldChild from the tree. If the newChild element already has a parent, it is // removed from this parent as part of the replace operation. Returns an error if // this element cannot accept children of the type of newChild. Returns an error if // the newChild is an ancestor of this element. // <param name="newChild">The element to be inserted.</param> // <param name="oldChild">The child element to be replaced. The oldChild element // must be an immediate child of this element.</param> function ReplaceChild(newChild: ID2D1SvgElement; oldChild: ID2D1SvgElement): HResult; stdcall; {$EXTERNALSYM ReplaceChild} // Removes the oldChild from the tree. Children of oldChild remain children of // oldChild. // <param name="oldChild">The child element to be removed. The oldChild element // must be an immediate child of this element.</param> function RemoveChild(oldChild: ID2D1SvgElement): HResult; stdcall; {$EXTERNALSYM RemoveChild} // Creates an element from a tag name. The element is appended to the list of // children. Returns an error if this element cannot accept children of the // specified type. // <param name="tagName">The tag name of the new child. An empty string is // interpreted to be a text content element.</param> // <param name="newChild">The new child element.</param> function CreateChild(tagName: PCWSTR; out newChild: ID2D1SvgElement): HResult; stdcall; {$EXTERNALSYM CreateChild} // Returns true if the attribute is explicitly set on the element or if it is // present within an inline style. Returns FALSE if the attribute is not a valid // attribute on this element. // <param name="name">The name of the attribute.</param> // <param name="inherited">Outputs whether the attribute is set to the 'inherit' // value.</param> function IsAttributeSpecified(name: PCWSTR; _inherited: PBOOL = Nil): BOOL; stdcall; {$EXTERNALSYM IsAttributeSpecified} // Returns the number of specified attributes on this element. Attributes are only // considered specified if they are explicitly set on the element or present within // an inline style. Properties that receive their value through CSS inheritance are // not considered specified. An attribute can become specified if it is set through // a method call. It can become unspecified if it is removed via RemoveAttribute. function GetSpecifiedAttributeCount(): UINT32; stdcall; {$EXTERNALSYM GetSpecifiedAttributeCount} // Gets the name of the specified attribute at the given index. // <param name="index">The specified index of the attribute.</param> // <param name="name">Outputs the name of the attribute.</param> // <param name="inherited">Outputs whether the attribute is set to the 'inherit' // value.</param> function GetSpecifiedAttributeName(index: UINT32; out name: PWSTR; nameCount: UINT32; _inherited: PBOOL = Nil): HResult; stdcall; {$EXTERNALSYM GetSpecifiedAttributeName} // Gets the string length of the name of the specified attribute at the given // index. The output string length does not include room for the null terminator. // <param name="index">The specified index of the attribute.</param> // <param name="nameLength">Outputs the string length of the name of the specified // attribute.</param> // <param name="inherited">Outputs whether the attribute is set to the 'inherit' // value.</param> function GetSpecifiedAttributeNameLength(index: UINT32; out nameLength: UINT32; {out_opt} _inherited: PBOOL = Nil): HResult; stdcall; {$EXTERNALSYM GetSpecifiedAttributeNameLength} // Removes the attribute from this element. Also removes this attribute from within // an inline style if present. Returns an error if the attribute name is not valid // on this element. function RemoveAttribute(name: PCWSTR): HResult; stdcall; {$EXTERNALSYM RemoveAttribute} // Sets the value of a text content element. function SetTextValue(name: WCHAR; nameCount: UINT32): HResult; stdcall; {$EXTERNALSYM SetTextValue} // Gets the value of a text content element. function GetTextValue(out name: PWSTR; nameCount: UINT32): HResult; stdcall; {$EXTERNALSYM GetTextValue} // Gets the length of the text content value. The returned string length does not // include room for the null terminator. function GetTextValueLength(): UINT32; stdcall; {$EXTERNALSYM GetTextValueLength} // Sets an attribute of this element using a string. Returns an error if the // attribute name is not valid on this element. Returns an error if the attribute // cannot be expressed as the specified type. function SetAttributeValue(name: PCWSTR; _type: D2D1_SVG_ATTRIBUTE_STRING_TYPE; value: PCWSTR): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a string. Returns an error if the attribute // is not specified. Returns an error if the attribute name is not valid on this // element. Returns an error if the attribute cannot be expressed as the specified // string type. function GetAttributeValue(name: PCWSTR; _type: D2D1_SVG_ATTRIBUTE_STRING_TYPE; {out} out value: PWSTR; valueCount: UINT32): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Gets the string length of an attribute of this element. The returned string // length does not include room for the null terminator. Returns an error if the // attribute is not specified. Returns an error if the attribute name is not valid // on this element. Returns an error if the attribute cannot be expressed as the // specified string type. function GetAttributeValueLength(name: PCWSTR; _type: D2D1_SVG_ATTRIBUTE_STRING_TYPE; out valueLength: UINT32): HResult; stdcall; {$EXTERNALSYM GetAttributeValueLength} /// <summary> /// Sets an attribute of this element using a POD type. Returns an error if the /// attribute name is not valid on this element. Returns an error if the attribute /// cannot be expressed as the specified type. /// </summary> function SetAttributeValue({_In_} name: PCWSTR; _type: D2D1_SVG_ATTRIBUTE_POD_TYPE; value: Pointer; valueSizeInBytes: UINT32): HResult; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a POD type. Returns an error if the // attribute is not specified. Returns an error if the attribute name is not valid // on this element. Returns an error if the attribute cannot be expressed as the // specified POD type. function GetAttributeValue(name: PCWSTR; _type: D2D1_SVG_ATTRIBUTE_POD_TYPE; value: Pointer; valueSizeInBytes: UINT32): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element using an interface. Returns an error if the // attribute name is not valid on this element. Returns an error if the attribute // cannot be expressed as the specified interface type. Returns an error if the // attribute object is already set on an element. A given attribute object may only // be set on one element in one attribute location at a time. function SetAttributeValue({_In_} name: PCWSTR; {_In_} value: ID2D1SvgAttribute): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as an interface type. Returns an error if the // attribute is not specified. Returns an error if the attribute name is not valid // on this element. Returns an error if the attribute cannot be expressed as the // specified interface type. // <param name="riid">The interface ID of the attribute value.</param> function GetAttributeValue({_In_} name: PCWSTR; {_In_} const riid: REFIID; {_COM_Outptr_result_maybenull_} value: Pointer = nil): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element using a float. function SetAttributeValue({_In_} name: PCWSTR; value: FLOAT): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a float. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: FLOAT): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a color. function SetAttributeValue({_In_} name: PCWSTR; value: PD2D1_COLOR_F): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a color. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_COLOR_F): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a fill mode. This method can be used to set // the value of the 'fill-rule' or 'clip-rule' properties. function SetAttributeValue({_In_}name: PCWSTR; value: D2D1_FILL_MODE): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a fill mode. This method can be used to get // the value of the 'fill-rule' or 'clip-rule' properties. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_FILL_MODE): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a display value. This method can be used to // set the value of the 'display' property. function SetAttributeValue({_In_} name: PCWSTR; value: D2D1_SVG_DISPLAY): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a display value. This method can be used to // get the value of the 'display' property. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_SVG_DISPLAY): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as an overflow value. This method can be used // to set the value of the 'overflow' property. function SetAttributeValue({_In_} name: PCWSTR; value: D2D1_SVG_OVERFLOW): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as an overflow value. This method can be used // to get the value of the 'overflow' property. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_SVG_OVERFLOW): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a line join value. This method can be used // to set the value of the 'stroke-linejoin' property. function SetAttributeValue({_In_} name: PCWSTR; value: D2D1_SVG_LINE_JOIN): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a line join value. This method can be used // to get the value of the 'stroke-linejoin' property. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_SVG_LINE_JOIN): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a line cap value. This method can be used // to set the value of the 'stroke-linecap' property. function SetAttributeValue({_In_} name: PCWSTR; value: D2D1_SVG_LINE_CAP): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a line cap value. This method can be used // to get the value of the 'stroke-linecap' property. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_SVG_LINE_CAP): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a visibility value. This method can be used // to set the value of the 'visibility' property. function SetAttributeValue({_In_} name: PCWSTR; value: D2D1_SVG_VISIBILITY): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a visibility value. This method can be used // to get the value of the 'visibility' property. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_SVG_VISIBILITY): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a matrix value. This method can be used to // set the value of a 'transform' or 'gradientTransform' attribute. function SetAttributeValue({_In_} PCWSTR name, value: PD2D1_MATRIX_3X2_F): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} /// Gets an attribute of this element as a matrix value. This method can be used to /// get the value of a 'transform' or 'gradientTransform' attribute. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_MATRIX_3X2_F): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a unit type value. This method can be used // to set the value of a 'gradientUnits' or 'clipPathUnits' attribute. function SetAttributeValue({_In_} name: PCWSTR; value: D2D1_SVG_UNIT_TYPE): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a unit type value. This method can be used // to get the value of a 'gradientUnits' or 'clipPathUnits' attribute. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_SVG_UNIT_TYPE): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as an extend mode value. This method can be // used to set the value of a 'spreadMethod' attribute. function SetAttributeValue({_In_} name: PCWSTR; value: D2D1_EXTEND_MODE): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a extend mode value. This method can be // used to get the value of a 'spreadMethod' attribute. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_EXTEND_MODE): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a preserve aspect ratio value. This method // can be used to set the value of a 'preserveAspectRatio' attribute. function SetAttributeValue({_In_} name: PCWSTR; value: PD2D1_SVG_PRESERVE_ASPECT_RATIO): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as a preserve aspect ratio value. This method // can be used to get the value of a 'preserveAspectRatio' attribute. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_SVG_PRESERVE_ASPECT_RATIO): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Sets an attribute of this element as a length value. function SetAttributeValue({_In_} name: PCWSTR; value: PD2D1_SVG_LENGTH): HResult; overload; stdcall; {$EXTERNALSYM SetAttributeValue} // Gets an attribute of this element as length value. function GetAttributeValue({_In_} name: PCWSTR; {_Out_} out value: PD2D1_SVG_LENGTH): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Gets an attribute of this element. function GetAttributeValue({_In_} PCWSTR name, {_COM_Outptr_result_maybenull_} value: ID2D1SvgAttribute = nil): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Gets an attribute of this element as a paint. This method can be used to get the // value of the 'fill' or 'stroke' properties. function GetAttributeValue({_In_} name: PCWSTR; {_COM_Outptr_result_maybenull_} value: ID2D1SvgPaint = nil): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Gets an attribute of this element as a stroke dash array. This method can be // used to get the value of the 'stroke-dasharray' property. function GetAttributeValue({_In_} name: PCWSTR; {_COM_Outptr_result_maybenull_} value: ID2D1SvgStrokeDashArray = nil): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Gets an attribute of this element as points. This method can be used to get the // value of the 'points' attribute on a 'polygon' or 'polyline' element. function GetAttributeValue({_In_} name: PCWSTR; {_COM_Outptr_result_maybenull_} value: ID2D1SvgPointCollection = nil): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} // Gets an attribute of this element as path data. This method can be used to get // the value of the 'd' attribute on a 'path' element. function GetAttributeValue({_In_} name: PCWSTR; {_COM_Outptr_result_maybenull_} value: ID2D1SvgPathData = nil): HResult; overload; stdcall; {$EXTERNALSYM GetAttributeValue} end; // interface ID2D1SvgElement It needs some polishing, but gives you the idea!
×