DECLARE integer mciSendString in WinMM.DLL ; string lpszCommand,; string @lpszReturnString,; integer cchReturn,; integer hwndCallback |
DECLARE integer SetWindowPos in User32.DLL ; integer hwnd,; integer hWndInsertAfter,; integer x,; integer y,; integer cx,; integer cy,; integer uFlags |
*调用外部接口库文件 SET library to sys(5)+sys(2003)+"\foxtools.fll" *声明WindowsAPI函数 DECLARE integer mciSendString in WinMM.DLL; string lpszCommand,; string @lpszReturnString,; integer cchReturn,; integer hwndCallback DECLARE integer SetWindowPos in User32.DLL ; integer hwnd,; integer hWndInsertAfter,; integer x,; integer y,; integer cx,; integer cy,; integer uFlags |
LPARAMETERS cMciCmd cRetString = space(80) nRetValue = mciSendString(cMciCmd, @cRetString, len(cRetString),0) RETURN allt(strtran(cRetString,"","")) |
ON error messagebox(message(),16,"出错") *初始化处理,关闭当前媒体文件。myMedia为TagAVI.avi文件的别名。 thisform.PlayMedia("CLOSE myMedia ") *获得当前表单窗口句柄 EXTERNAL procedure _WhToHwnd EXTERNAL procedure _WOnTop cur_window = _WhToHwnd(_WOnTop()) *打开媒体文件 cCmd='OPEN "TagAVI.avi" alias myMedia'+' style child parent '+ allt(str(cur_window)) thisform.PlayMedia(cCmd) cCmd = "status myMedia window handle" hWin =int(val(thisform.PlayMedia(cCmd))) *在当前表单的适当位置播放媒体文件 setWindowPos(hWin,0,0,170,80,40,0) thisform.PlayMedia("PLAY myMedia") |
cCmd = ("STATUS myMedia MODE") IF thisform.PlayMedia(cCmd) = "stopped" nLen=val(thisform.PlayMedia("STATUS myMedia length")) nPos=val(thisform.PlayMedia("STATUS myMedia position")) *如果已经播放到片尾,则回到片头 IF nPos>=nLen then thisform.PlayMedia("SEEK myMedia to start ") ENDIF *重新播放 thisform.PlayMedia("PLAY myMedia") ENDIF |
联系客服