Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Extern IID_ wie in Delphi einbinden (https://www.delphipraxis.net/91866-extern-iid_-wie-delphi-einbinden.html)

EWeiss 11. Mai 2007 05:09


Extern IID_ wie in Delphi einbinden
 
In C#

Code:
EXTERN_C const IID IID_IWMPEffects;
Wie in Delphi einbinden ?
Finde keinen Verweis auf die IID

Benötige diese Interface-ID für CoCreateInstance ..
Oder kann man diese mit einer API während der Laufzeit in erfahrung bringen?



gruss Emil

marabu 11. Mai 2007 06:29

Re: Extern IID_ wie in Delphi einbinden
 
Guten Morgen Emil,

ich kann das jetzt nicht prüfen, weil auf meinem Rechner im Büro kein WMP installiert ist, aber bei dir müsste im Ordner %WINDIR%\SYSTEM32 eine WMP.DLL liegen. Für diese DLL solltest du mit TLIBIMP eine Delphi Wrapper Unit erzeugen können und in der findest du dann alles was dein Herz begehrt. Zur Not schau mal hier: Delphi Media Player Visualizations

Freundliche Grüße

EWeiss 11. Mai 2007 06:42

Re: Extern IID_ wie in Delphi einbinden
 
Zitat:

Zitat von marabu
Guten Morgen Emil,

ich kann das jetzt nicht prüfen, weil auf meinem Rechner im Büro kein WMP installiert ist, aber bei dir müsste im Ordner %WINDIR%\SYSTEM32 eine WMP.DLL liegen. Für diese DLL solltest du mit TLIBIMP eine Delphi Wrapper Unit erzeugen können und in der findest du dann alles was dein Herz begehrt. Zur Not schau mal hier: Delphi Media Player Visualizations

Freundliche Grüße

Danke für deine Informationen.
Die Url war mir bekannt ;)

Hier mal die Unit mit ein paar kleinen änderungen.

Delphi-Quellcode:
unit WMPEffects;

interface

uses
   Windows, WMPLib_TLB;

const
   SA_BUFFER_SIZE = 1024;

Type EffectsCapability =
   (EFFECT_CANGOFULLSCREEN     = $00000001,  // can the effect go full screen?
   EFFECT_HASPROPERTYPAGE      = $00000002,  // does the effect have a property page?
   EFFECT_VARIABLEFREQSTEP     = $00000004,  // should effect return frequency data with variable size steps?
  EFFECT_WINDOWEDONLY         = $00000008,
  EFFECT2_FULLSCREENEXCLUSIVE = $00000010);

Type
   TimedLevel = record
      frequency : array [0..1, 0..SA_BUFFER_SIZE-1] of byte;
    waveform : array [0..1, 0..SA_BUFFER_SIZE-1] of byte;
    state : integer;
    timeStamp : int64;
  end;

  IWMPEffects = interface(IUnknown)
     ['{D3984C13-C3CB-48e2-8BE5-5168340B4F35}']

    // Render using the rectangle on the normalized device context
    //void Render(ref TimedLevel levels, IntPtr hdc, ref RECT r);
    procedure Render(var pLevels : TimedLevel; hdc : HDC; var prc : TRect); safecall;

    // provides the no. channels, sample rate and title of the audio currently playing
    procedure MediaInfo(lChannelCount : longint; lSampleRate : longint; bstrTitle : WideString); safecall;

    // called to retrieive the capabilities of the effect (fullscreen? property page?, etc.)
    procedure GetCapabilities(var pdwCapabilities : DWORD); safecall;

    // retrieve the display title of the effect
    procedure GetTitle(var bstrTitle : WideString); safecall;

    // retrieve the title for a preset
    procedure GetPresetTitle(nPreset : LongInt; var bstrPresetTitle : WideString); safecall;

    // retrieve the number of presets this effect supports
    procedure GetPresetCount(var pnPresetCount : LongInt); safecall;

    // set / get the current preset
    procedure SetCurrentPreset(nPreset : LongInt); safecall;
    procedure GetCurrentPreset(var pnPreset : LongInt); safecall;

    // display the property page of the effect (if there is one)
    procedure DisplayPropertyPage(hwndOwner : HWND); safecall;

    // This method will be called when the effect is to start and stop full screen
    // rendering (if supported)
    procedure GoFullscreen(fFullScreen : BOOL); safecall;

    // This method will get called after a successful call to GoFullScreen to render
    // the effect. Return failure from this method to signal loss of full screen.
    procedure RenderFullScreen(var pLevels : TimedLevel); safecall;
  end;


  IWMPEffects2 = interface(IWMPEffects)
  ['{695386EC-AA3C-4618-A5E1-DD9A8B987632}']
    // Called by Windows Media Player to provide visualization access to the
    // core Windows Media Player APIs.
    procedure SetCore(var pPlayer : IWMPCore); safecall;

    // Called by Windows Media Player to instantiate a visualization window
    procedure Create(hwndParent : HWND); safecall;

    // Called by Windows Media Player to destroy a visualization window
    // instantiated in the Create method.
    procedure Destroy; safecall;

    //Called by Windows Media Player to inform the visualization that a new
    //media item has been loaded.
    procedure NotifyNewMedia(var pMedia : IWMPMedia); safecall;

    // Called by Windows Media Player to pass window messages to a visualization.
    procedure OnWindowMessage(msg : UINT; WParam : WPARAM; LParam : LPARAM;
      var plResultParam : LRESULT); safecall;

    // Called by Windows Media Player to render a windowed visualization.
    procedure RenderWindowed(var pData : TimedLevel; fRequiredRender : BOOL); safecall;
  end;


implementation

end.
Auch habe ich die komplette WMP.TLB implementiert (teile rausgeworfen die nichts mit der Vis zu tun haben).
Aber kann keinen eintrag finden für die Interface ID von IWMPEffects.
Bisher habe ich mir so geholfen das ich quasi einen Temporären WMP(Skin) ausführe und diesen als Parent in die ausführende Anwendung verschiebe.
Der nachteil ist aber dann das die Musik über den WMP ablaufen muss um die Vis anzuzeigen das soll aber über die BassLib geschehen.


EDIT:
Vielleicht ??
Delphi-Quellcode:
WMPEffects = IWMPEffectsCtrl;
davon die IID ? wäre aber dann nicht zuständig für IWMPEffects oder doch ?
Ist die einzigste die ich finden kann.
Delphi-Quellcode:
IID_IWMPEffectsCtrl
Ich möchte aber eigentlich nicht das Control ansprechen sondern nur den, die Effecte.


gruss Emil

marabu 11. Mai 2007 07:08

Re: Extern IID_ wie in Delphi einbinden
 
Hallo Emil,

du hast doch die Header-Datei EFFECTS.H aus dem Windows Media SDK - daraus stammt wohl die von dir zitierte Zeile. Da steht aber noch mehr:

Code:
EXTERN_C const IID IID_IWMPEffects;

#if defined(__cplusplus) && !defined(CINTERFACE)
   
    MIDL_INTERFACE("D3984C13-C3CB-48e2-8BE5-5168340B4F35")
    IWMPEffects : public IUnknown
Das kannst du so umsetzen:

Delphi-Quellcode:
IID_IWMPEffects : TGUID = '{D3984C13-C3CB-48e2-8BE5-5168340B4F35}';
Du findest den Schlüssel für dieses Interface auch in der Registry unter HKCR\Interface.

Freundliche Grüße

EWeiss 11. Mai 2007 07:23

Re: Extern IID_ wie in Delphi einbinden
 
Zitat:

Zitat von marabu
Hallo Emil,

du hast doch die Header-Datei EFFECTS.H aus dem Windows Media SDK - daraus stammt wohl die von dir zitierte Zeile. Da steht aber noch mehr:

Code:
EXTERN_C const IID IID_IWMPEffects;

#if defined(__cplusplus) && !defined(CINTERFACE)
   
    MIDL_INTERFACE("D3984C13-C3CB-48e2-8BE5-5168340B4F35")
    IWMPEffects : public IUnknown
Das kannst du so umsetzen:

Delphi-Quellcode:
IID_IWMPEffects : TGUID = '{D3984C13-C3CB-48e2-8BE5-5168340B4F35}';
Du findest den Schlüssel für dieses Interface auch in der Registry unter HKCR\Interface.

Freundliche Grüße

Jo ;)
Supi danke genau das wars was ich brauche.. fehlte nämlich in der 'unit WMPEffects' noch.

gruss Emil


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:17 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz