![]() |
Operator will wieder nicht!
Hi
Delphi-Quellcode:
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);
Delphi-Quellcode:
Fehler:
Var
dwCaps : LongInt; CanGoFullScreen : boolean; WindowedOnly : boolean; FullScreenExclusive : boolean; begin if not Assigned(_IWmpEffects) then begin result := false; exit; end; dwCaps := 0; GetCapabilities(dwCaps); CanGoFullScreen := (dwCaps and EFFECT_CANGOFULLSCREEN); Zitat:
Delphi-Quellcode:
Warum?
CanGoFullScreen := (dwCaps and EFFECT_CANGOFULLSCREEN);
gruss Emil |
Re: Operator will wieder nicht!
du versuchst einem Boolean Ordinalwert zu zuweisen (und einen Integer konnte man noch nie einem Boolean zuweisen). Ein einfacher Cast und es funktioniert.
|
Re: Operator will wieder nicht!
Zitat:
Delphi-Quellcode:
Wenn ja , geht auch nicht.
CanGoFullScreen := bool(dwCaps and EFFECT_CANGOFULLSCREEN);
gruss Emil |
Re: Operator will wieder nicht!
Delphi-Quellcode:
CanGoFullScreen := (dwCaps and EFFECT_CANGOFULLSCREEN) > 0;
|
Re: Operator will wieder nicht!
oh, ich seh gerade das EFFECT_CANGOFULLSCREEN kein Integer, Cardinal etc. ist sondern Teil eines Enums. Daher wäre es das sinnvollste dwCaps als "Set of" zu declarieren oder wenn es so bleiben soll wie es ist musst du EFFECT_CANGOFULLSCREEN auf Byte casten.
Delphi-Quellcode:
CanGoFullScreen := Boolean((dwCaps and Byte(EFFECT_CANGOFULLSCREEN)));
|
Re: Operator will wieder nicht!
Zitat:
War mein ursprünglicher code. Geht aber nicht! [Pascal Error] WMPUnit.pas(1198): E2015 Operator not applicable to this operand type [Pascal Warning] WMPUnit.pas(1198): W1023 Comparing signed and unsigned types - widened both operands Gruss Emil |
Re: Operator will wieder nicht!
Thanks SirThornberry
Jetzt gehts ;) Gruss Emil |
Re: Operator will wieder nicht!
Wenn Du es so machst, sollte es gehen:
Delphi-Quellcode:
const 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 EffectsCapability = ( EFFECT_CANGOFULLSCREEN, EFFECT_HASPROPERTYPAGE, EFFECT_VARIABLEFREQSTEP, EFFECT_WINDOWEDONLY, EFFECT2_FULLSCREENEXCLUSIVE); |
Re: Operator will wieder nicht!
Zitat:
Ich habs jetzt so und müßte funktionieren. Trotzdem Danke für die info
Delphi-Quellcode:
function BASS_WMPVIS_SetFullScreen(FullScreen: BOOL): boolean; stdcall;
Var hr : HRESULT; dwCaps : LongInt; CanGoFullScreen : boolean; WindowedOnly : boolean; FullScreenExclusive : boolean; begin if not Assigned(_IWmpEffects) then begin result := false; exit; end; dwCaps := 0; GetCapabilities(dwCaps); CanGoFullScreen := Boolean((dwCaps and Byte(EFFECT_CANGOFULLSCREEN))); WindowedOnly := Boolean((dwCaps and Byte(EFFECT_WINDOWEDONLY))); FullScreenExclusive := Boolean((dwCaps and Byte(EFFECT2_FULLSCREENEXCLUSIVE))); if (not CanGoFullScreen or WindowedOnly or FullScreenExclusive) then begin result := false; exit; end; hr := GoFullscreen(FullScreen); Result := hr = S_OK; end; |
Re: Operator will wieder nicht!
ein Set erscheint mir hier sonnvoller (dwCaps) - dann könnte man einfach mit "in" überprüfen.
|
Re: Operator will wieder nicht!
Hallo,
mit
Delphi-Quellcode:
bekommt er ja eine Longint befüllt. Also bleibt sich das im Endeffekt gleich, außer dass er bei einem Set die Konstantendefinition wie aus meinem Posting wählen müsste, um das Set zu befüllen und anschließend wieder abzufragen, oder habe ich da was falsch verstanden?
GetCapabilities(dwCaps);
|
Re: Operator will wieder nicht!
Zitat:
Delphi-Quellcode:
// called to retrieive the capabilities of the effect (fullscreen? property page?, etc.)
procedure GetCapabilities(var pdwCapabilities : DWORD); safecall;
Delphi-Quellcode:
gruss Emil
function GetCapabilities(var caps: LongInt): HRESULT;
Var DwVal: DWORD; begin if Assigned(_IWmpEffects) then begin DwVal := 0; _IWmpEffects.GetCapabilities(DwVal); caps := DwVal; result := DwVal; end else result := -1; end; |
Re: Operator will wieder nicht!
Hab ich ja gesagt ;)
|
Re: Operator will wieder nicht!
Hallo,
beim harten TypeCast mit Boolean ist zu beachten, daß dieser nur funktioniert, wenn der umzuwandelnde Wert (wie in diesem Beispiel) im Bytebereich liegt. Bei höheren Werten sollte man LongBool verwenden. Gruß Hawkeye |
Re: Operator will wieder nicht!
Zitat:
Oder kann ich es so belassen. gruss Emil |
Re: Operator will wieder nicht!
du kannst auch einfach anstelle des Casts auf > 0 prüfen (wie bereits oben gepostet (nicht von mir))
|
Re: Operator will wieder nicht!
Hallo Emil,
Zitat:
Delphi-Quellcode:
Die erste IF-Abfrage sieht doch gut aus, hättest du da einen Fehler vermutet?
const
EFFECT_ONLYFORDEMO = $00010000; var value : Cardinal; begin value := $ffffffff; if Boolean(value and EFFECT_ONLYFORDEMO) then ShowMessage ('sollte nicht angezeigt werden'); if LongBool(value and EFFECT_ONLYFORDEMO) then ShowMessage ('sollte angezeigt werden'); end; Gruß Hawkeye |
Re: Operator will wieder nicht!
Zitat:
Habe trotzdem ein problem bekomme mit miner Funktion immer einen 0 wert zurückgeliefert müßte aber eigentlich FullScreen möglich sein. Na muss mal schaun. EDIT: Funktioniert doch richtig ;) gruss Emil |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:08 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