Autor Beitrag
Millencolin15
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Mo 10.02.03 14:44 
yo,
ich wollt mal wissen wie man bei TMediaplayer die lautstärke ändert???
:?:
oder vielleicht nen apibefehl dafür??????
ciao leudde
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Mi 12.02.03 18:14 
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
uses 
  MPlayer, MMSystem; 

const 
  MCI_SETAUDIO = $0873; 
  MCI_DGV_SETAUDIO_VOLUME = $4002; 
  MCI_DGV_SETAUDIO_ITEM = $00800000; 
  MCI_DGV_SETAUDIO_VALUE = $01000000; 
  MCI_DGV_STATUS_VOLUME = $4019; 

type 
  MCI_DGV_SETAUDIO_PARMS = record 
    dwCallback: DWORD; 
    dwItem: DWORD; 
    dwValue: DWORD; 
    dwOver: DWORD; 
    lpstrAlgorithm: PChar; 
    lpstrQuality: PChar; 
  end; 

type 
  MCI_STATUS_PARMS = record 
    dwCallback: DWORD; 
    dwReturn: DWORD; 
    dwItem: DWORD; 
    dwTrack: DWORD; 
  end; 

procedure SetMPVolume(MP: TMediaPlayer; Volume: Integer); 
  { Volume: 0 - 1000 } 
var 
  p: MCI_DGV_SETAUDIO_PARMS; 
begin 
  { Volume: 0 - 1000 } 
  p.dwCallback := 0; 
  p.dwItem := MCI_DGV_SETAUDIO_VOLUME; 
  p.dwValue := Volume; 
  p.dwOver := 0; 
  p.lpstrAlgorithm := nil; 
  p.lpstrQuality := nil; 
  mciSendCommand(MP.DeviceID, MCI_SETAUDIO, 
    MCI_DGV_SETAUDIO_VALUE or MCI_DGV_SETAUDIO_ITEM, Cardinal(@p)); 
end; 

function GetMPVolume(MP: TMediaPlayer): Integer; 
var  
  p: MCI_STATUS_PARMS; 
begin 
  p.dwCallback := 0; 
  p.dwItem := MCI_DGV_STATUS_VOLUME; 
  mciSendCommand(MP.DeviceID, MCI_STATUS, MCI_STATUS_ITEM, Cardinal(@p)); 
  Result := p.dwReturn; 
  { Volume: 0 - 1000 } 
end; 

// Example, Beispiel: 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  SetMPVolume(MediaPlayer1, 500); 
end;


Moderiert von user profile iconMarc: Code-Tag hinzugefügt.
Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Mi 12.02.03 18:19 
Hi,

@TORSTEN: da wird der Admin aber schimpfen, wenn du deinen Code nicht formatierst ;)

AXDM
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Mi 12.02.03 18:25 
:oops: opsala...

naja, nächstes mal pass ich besser auf (wenn ich net vergesse) :wink2:
Marc
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 169

Win 2000, Win XP, SuSE Linux 8.2

BeitragVerfasst: Do 13.02.03 12:47 
AXMD hat folgendes geschrieben:
...da wird der Admin aber schimpfen, wenn du deinen Code nicht formatierst...
Wir schimpfen doch nie! :D

torstenheinze hat folgendes geschrieben:
...naja, nächstes mal pass ich besser auf (wenn ich net vergesse)...
Du kannst auch Deine Topic's editieren (über den Edit-Button), dann könntest Du die Code-Tags nachträglich hinzufügen.

Gruß Marc
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Do 13.02.03 14:38 
ok