Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: SonnyBoyXXl on September 16, 2018, 01:27:54 am

Title: Problem with DirectComposition - DComp Header
Post by: SonnyBoyXXl on September 16, 2018, 01:27:54 am
Hi folks,

I've converted the DirectComposition Headers (DCOMP.DLL) to pascal. I also did a convertion of a example on the MSDN Homepage.
Now the strange part: the Application is only running correctly when I change the order of two functions of one interface.

Original Heade-File:
Quote
#undef INTERFACE
#define INTERFACE IDCompositionVisual
DECLARE_INTERFACE_IID_(IDCompositionVisual, IUnknown, "4d93059d-097b-4651-9a60-f0f25116e2f3")
{
    // Changes the value of OffsetX property
    STDMETHOD(SetOffsetX)(THIS_
        float offsetX
        ) PURE;

    // Animates the value of the OffsetX property.
    STDMETHOD(SetOffsetX)(THIS_
        _In_ IDCompositionAnimation* animation
        ) PURE;

    // Changes the value of OffsetY property
    STDMETHOD(SetOffsetY)(THIS_
        float offsetY
        ) PURE;

    // Animates the value of the OffsetY property.
    STDMETHOD(SetOffsetY)(THIS_
        _In_ IDCompositionAnimation* animation
        ) PURE;

To get the example running I must change the order of the functions in the interface declaration, otherwise the function call to the interface crashes.

Working translation to pascal
Code: Pascal  [Select]
  1. IDCompositionVisual = interface(IUnknown)
  2.         ['{4d93059d-097b-4651-9a60-f0f25116e2f3}']
  3.         // Animates the value of the OffsetX property.
  4.         function SetOffsetX(animation: IDCompositionAnimation): HResult; stdcall; overload;
  5.         // Changes the value of OffsetX property
  6.         function SetOffsetX(offsetX: single): HResult; stdcall; overload;
  7.         // Animates the value of the OffsetY property.
  8.         function SetOffsetY(animation: IDCompositionAnimation): HResult; stdcall;  overload;
  9.         // Changes the value of OffsetY property
  10.         function SetOffsetY(offsetY: single): HResult; stdcall;  overload;  

Someone knows why to make this change?
Is the original header file wrong - has someone experience with the DCOMP?
Or is there a problem how the compiler orders the VPTR? Btw, changing the names of the function (to avoid the overload) doesnt solve the problem...
Since there are many of this Offset functions (and other manipulation functions) in similar Interfaces, I do not want to check all interfaces manually :(

Best regards