![]() |
Re: Operator not applicable
Zitat:
Bei intval mit oder ohne Zeiger [Pascal Error] WMPUnit.pas(221): E2018 Record, object or class type required If Assigned(IWmpEffects) Then [Pascal Error] WMPUnit.pas(218): E2008 Incompatible types If IWmpEffects <> nil Then [Pascal Error] WMPUnit.pas(218): E2015 Operator not applicable to this operand type Arrrrggghhhh :wall: :mrgreen: Gruss Emil |
Re: Operator not applicable
Zitat:
In C# OK da gibts diverse Beispiele an die man sich halten kann. Mit der Instanz verstehe ich jetzt nicht was du da meinst. Gruss Emil |
Re: Operator not applicable
Mir fällt da gerade was auf... in der Interfacedeklaration deines ersten Posts ist GetPresetCount eine Prozedur. Ich vermute stark, dass da die Typinkompatibilität liegt, denn du versuchst ja das nicht vorhandene Ergebnis result zuzuweisen.
Und: hast du eine Instanz(~Variable) deines interfaces? Du rufst die Routine nämlich am interface auf, du musst sie an der Variablen aufrufen. |
Re: Operator not applicable
IWmpEffects ist ein Interface und keine Instanz, die es implemnetiert.
Genausowenig wie du z.B.
Delphi-Quellcode:
schreibst sondern
if Integer = 0
Delphi-Quellcode:
i: integer;
... if i = 0 |
Re: Operator not applicable
Zitat:
Werds mal versuchen ;) gruss Emil |
Re: Operator not applicable
So gehts jetzt bis auf einen Fehler ;)
Delphi-Quellcode:
result := WmpEffects.GetPresetCount(IntVal);
function GetPresetCount(var count: LongInt): HRESULT;
Var IntVal: LongInt; WmpEffects: IWmpEffects; begin If Assigned(WmpEffects) Then begin IntVal := 0; result := WmpEffects.GetPresetCount(IntVal); count := IntVal; end else result := -1; end; [Pascal Error] WMPUnit.pas(222): E2010 Incompatible types: 'HRESULT' and 'procedure, untyped pointer or untyped parameter' Gruss Emil |
Re: Operator not applicable
Delphi-Quellcode:
WmpEffects.GetPresetCount(IntVal);
result := IntVal; |
Re: Operator not applicable
Zitat:
Delphi-Quellcode:
So gehts nun! Vielen Dank an alle die geholfen haben ;)
function GetPresetCount(var count: LongInt): HRESULT;
Var IntVal: LongInt; begin If Assigned(PWmpEffects) Then begin IntVal := 0; PWmpEffects.GetPresetCount(IntVal); result := IntVal; count := IntVal; end else result := -1; end; Aber eine frage noch im Anhang warum geht es nicht über die direkte Abfrage
Delphi-Quellcode:
nur auf deine weise ?
result := PWmpEffects.GetPresetCount(IntVal);
gruss Emil |
Re: Operator not applicable
Ich habe schon mal einen Post dazu geschrieben (#13). In deiner Interfacedeklaration ist getPresetCount eine Prozedur, und die gibt nunmal nichts zurück, das du zuweisen könntest.
|
Re: Operator not applicable
Zitat:
Delphi-Quellcode:
Deshalb wird versucht Result die Methode zuzuweisen, was obigen Fehler auslöst.
IWMPEffects = interface(IUnknown)
['{D3984C13-C3CB-48e2-8BE5-5168340B4F35}'] procedure GetPresetCount(var pnPresetCount : LongInt); safecall; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:40 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