Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Operator will wieder nicht! (https://www.delphipraxis.net/92839-operator-will-wieder-nicht.html)

EWeiss 27. Mai 2007 08:44


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:
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);
Fehler:
Zitat:

[Pascal Error] WMPUnit.pas(1198): E2015 Operator not applicable to this operand type
Delphi-Quellcode:
CanGoFullScreen := (dwCaps and EFFECT_CANGOFULLSCREEN);
Warum?

gruss Emil

SirThornberry 27. Mai 2007 08:49

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.

EWeiss 27. Mai 2007 08:55

Re: Operator will wieder nicht!
 
Zitat:

Zitat von SirThornberry
du versuchst einem Boolean Ordinalwert zu zuweisen (und einen Integer konnte man noch nie einem Boolean zuweisen). Ein einfacher Cast und es funktioniert.

Du meinst..
Delphi-Quellcode:
CanGoFullScreen := bool(dwCaps and EFFECT_CANGOFULLSCREEN);
Wenn ja , geht auch nicht.

gruss Emil

DeddyH 27. Mai 2007 08:55

Re: Operator will wieder nicht!
 
Delphi-Quellcode:
CanGoFullScreen := (dwCaps and EFFECT_CANGOFULLSCREEN) > 0;

SirThornberry 27. Mai 2007 08:58

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)));

EWeiss 27. Mai 2007 09:00

Re: Operator will wieder nicht!
 
Zitat:

Zitat von DeddyH
Delphi-Quellcode:
CanGoFullScreen := (dwCaps and EFFECT_CANGOFULLSCREEN) > 0;

Ja.
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

EWeiss 27. Mai 2007 09:04

Re: Operator will wieder nicht!
 
Thanks SirThornberry

Jetzt gehts ;)

Gruss Emil

DeddyH 27. Mai 2007 09:06

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);

EWeiss 27. Mai 2007 09:12

Re: Operator will wieder nicht!
 
Zitat:

Zitat von DeddyH
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);

Hmmm ..

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;

SirThornberry 27. Mai 2007 09:17

Re: Operator will wieder nicht!
 
ein Set erscheint mir hier sonnvoller (dwCaps) - dann könnte man einfach mit "in" überprüfen.


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:33 Uhr.
Seite 1 von 2  1 2      

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