作者: jballi 最近更新时间: nonexistent
This library gives the AutoHotkey developer access to the the Media Control Interface (MCI) which provides standard commands for playing/controlling multimedia devices.
MCI_Close(p_lpszDeviceID)
MCI_CurrentTrack(p_lpszDeviceID)
MCI_DeviceType(p_lpszDeviceID)
MCI_Length(p_lpszDeviceID,p_Track=0)
MCI_MediaIsPresent(p_lpszDeviceID)
MCI_Notify(wParam,lParam,msg,hWnd)
MCI_NumberOfTracks(p_lpszDeviceID)
MCI_Open(p_MediaFile,p_Alias="",p_Flags="")
MCI_OpenCDAudio(p_Drive="",p_Alias="",p_CheckForMedia=True)
MCI_Pause(p_lpszDeviceID)
MCI_Play(p_lpszDeviceID,p_Flags="",p_Callback="",p_hwndCallback=0)
MCI_Position(p_lpszDeviceID,p_Track=0)
MCI_Record(p_lpszDeviceID,p_Flags="")
MCI_Resume(p_lpszDeviceID)
MCI_Save(p_lpszDeviceID,p_FileName)
MCI_Seek(p_lpszDeviceID,p_Position)
MCI_SendString("sysinfo all quantity open",l_OpenMCIDevices)
MCI_SetBass(p_lpszDeviceID,p_Factor)
MCI_SetTreble(p_lpszDeviceID,p_Factor)
MCI_SetVolume(p_lpszDeviceID,p_Factor)
MCI_Status(p_lpszDeviceID)
MCI_Stop(p_lpszDeviceID)
MCI_ToHHMMSS(p_ms,p_MinimumSize=4)
MCI_ToMilliseconds(Hour,Min,Sec)
MCI_TrackIsAudio(p_lpszDeviceID,p_Track=1)
关于函数的参数和返回值, 请参阅其源码或 此文档.
More about the MCI at the MSDN:
http://msdn.microsoft.com/en-us/library/ms709461(VS.85).aspx
关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=35266
不存在
; #Include MCI.ahk #NoEnv #SingleInstance Force gui Margin,0,0 gui Add,Button,w70 h35,Open gui Add,Button,x+0 wp hp,Play gui Add,Button,x+0 wp hp,Pause gui Add,Button,x+0 wp hp,Stop gui,Add,Button,x+0 wp hp,Rev10 gui,Add,Button,x+0 wp hp,Middle gui,Add,Button,x+0 wp hp,Fwd10 gui Show gosub ButtonOpen return GUIEscape: GUIClose: if Open MCI_Close(hMedia) ExitApp ButtonOpen: if Open MCI_Close(hMedia) if not DefaultFolder DefaultFolder:=A_MyDocuments gui +OwnDialogs FileSelectFile, MediaFile,1,%DefaultFolder%,Choose a media file if MediaFile= return SplitPath MediaFile,,DefaultFolder hMedia:=MCI_Open(MediaFile) if Not hMedia { MsgBox Error opening media file return } Open:=true gosub ButtonPlay return ButtonPlay: if Open { Status:=MCI_Status(hMedia) if Status=stopped MCI_Play(hMedia,"","NotifyEndOfPlay") ;-- Note: The callback option is used here as an example. This ; script is not a really a good example of how/where the ; callback option should be used because of all of the seek ; interruptions. else if Status=paused MCI_Resume(hMedia) } return ButtonPause: if Open { Status:=MCI_Status(hMedia) if Status=playing MCI_Pause(hMedia) else if Status=paused MCI_Resume(hMedia) } return ButtonStop: if Open { MCI_Stop(hMedia) MCI_Seek(hMedia,0) } return ButtonFwd10: if Open if MCI_Status(hMedia)="playing" MCI_Seek(hMedia,MCI_Position(hMedia)+10000) ;-- Note: This seek method works for most (but not all) MCI devices return ButtonMiddle: if Open if MCI_Status(hMedia)="playing" MCI_Seek(hMedia,MCI_Length(hMedia)/2) ;-- Note: This seek method works for most (but not all) MCI devices return ButtonRev10: if Open if MCI_Status(hMedia)="playing" MCI_Seek(hMedia,MCI_Position(hMedia)-10000) ;-- Note: This seek method works for most (but not all) MCI devices return NotifyEndOfPlay(flag) { Global if flag=1 ;-- 1=play ended normally { MCI_Stop(hMedia) MCI_Seek(hMedia,0) } } ;#include MCI.ahk