求教这个API函数的用法。(50分)

  • 主题发起人 主题发起人 myveremy
  • 开始时间 开始时间
M

myveremy

Unregistered / Unconfirmed
GUEST, unregistred user!
当一个mediaplayer在播放一个节目时,我想用两个按扭来控制它声音的开与关.<br>(好象要用某个api来做,希望有人帮我下)
 
waveOutClose &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;关闭声音输出设备 <br>waveOutOpen &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 打开声音输出设备
 
樓上的兄弟:<br> &nbsp;可否說下它的具體用法?<br> &nbsp;我直接把handle傳給它,但不行啊!!!!!!!
 
先定义常量<br>CONST<br> &nbsp;MCI_SETAUDIO=$873;<br> &nbsp;MCI_SETVIDEO=$0876;<br>定义结构<br>type MCI_DGV_SETAUDIO_PARMS=record<br> &nbsp;dwCallback:DWORD;<br> &nbsp;dwItem:DWORD;<br> &nbsp;dwValue:DWORD;<br> &nbsp;dwOver:DWORD;<br> &nbsp;lpstrAlgorithm:PChar;<br> &nbsp;lpstrQuality:PChar;<br>end ;<br><br>procedure wavechange;<br>var<br> &nbsp;s: MCI_DGV_SETAUDIO_PARMS ;<br>begin<br> &nbsp;//关闭声音 &nbsp;如有多个MCI设备,则为midiaplayer2.deviceid......<br> &nbsp;mciSendCommand(MediaPlayer1.DeviceID,MCI_SETAUDIO, MCI_SET_OFF ,integer(@s));<br>//打开声音<br> &nbsp;mciSendCommand(MediaPlayer1.DeviceID,MCI_SETAUDIO, MCI_SET_ON ,integer(@s));<br>END;<br>我试了,没有一点错
 
是否要引用單元????<br><br>提示錯誤: &nbsp; &nbsp; <br>Undeclared identifier: 'mciSendCommand'<br>Undeclared identifier: 'MediaPlayer1'
 
我控制的是windows xp自帶的media player 9媒體播放器<br>(不是我自已用mediaplayer控件寫的媒體播放器)
 
USER mmsystem<br><br><br>var<br> &nbsp;s: MCI_DGV_SETAUDIO_PARMS ;<br> &nbsp;H:Thandle;<br>begin<br> &nbsp; &nbsp;H := FindWindow(nil, 'Windows Media Player');<br> &nbsp; &nbsp;if H &gt; 0 then<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; SetForegroundWindow(H);<br> &nbsp; &nbsp; &nbsp; mciSendCommand(H,MCI_SETAUDIO, MCI_SET_OFF ,integer(@s));<br> &nbsp; &nbsp;end;<br>END;<br><br>但是沒有效果(沒有关闭声音)?????
 
帮助,离线资料,Google, 基本上这些就可以解决问题了
 
仔细研究
 
繼續中!!!!!!
 
mciSendCommand(MediaPlayer1.DeviceID,MCI_SETAUDIO, MCI_SET_OFF ,integer(@s));
 
還沒搞定啊!!!!!!
 
多人接受答案了。
 
后退
顶部