欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

vb.net播放器,vb播放器控件

vb.net做音頻播放器,如何消除對(duì)話框

有點(diǎn)復(fù)雜,如果是Excel,有Application.DisplayAlerts=False'這是Excel阻止警告

成都創(chuàng)新互聯(lián)公司是專業(yè)的永仁網(wǎng)站建設(shè)公司,永仁接單;提供網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè),網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行永仁網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!

我粗看了下MediaPlayer沒(méi)有提供類似的接口,試著用消息捕獲的方法看看

Protected?Overrides?Sub?WndProc(ByRef?m?As?System.Windows.Forms.Message)?'消息捕獲

If?m.Msg?=?H999?Then?'這里的值要你自己去測(cè)試出來(lái)(就是彈出對(duì)話框時(shí)的值)

SendKeys.Send("{ENTER}")?'發(fā)送回車鍵

End?If

MyBase.WndProc(m)

End?Sub

VB.NET 視頻播放器

Windows Media Player 我使用很正常啊,外面單獨(dú)使用也正常

而且視頻播放正不正常其實(shí)是調(diào)用視頻的解碼模塊來(lái)實(shí)現(xiàn)的,跟程序本身關(guān)系不大

建議你下載“終極解碼FinalCodecs”安裝后重新嘗試Windows Media Player控件

vb.net中編輯音樂(lè)播放器用什么控件添加音樂(lè)

需要用到COM控件,例如media player、Real player等,或者用 .NET 自帶的類庫(kù) System.Media下面的 SoundPlayer來(lái)播放音樂(lè)

簡(jiǎn)單的播放器用vb.net怎么做啊

右擊工具箱/部件/WindowsMediaPlayer

//類模塊Mmedia

Option Explicit

'-----------------------------------------------------

' Name : MMedia.cls

' Author : Peter Wright, For BG2VB4 BG2VB5

'

' Notes : A multimedia class, which when turned

' : into an object lets you load and play

' : multimedia files, such as sound and

' : video.

'-----------------------------------------------------

' -=-=-=- PROPERTIES -=-=-=-

' Filename Determines the name of the current file

' Length The length of the file (Read Only)

' Position The current position through the file

' Status The current status of the object (Read Only)

' Wait True/False...tells VB to wait until play done

' -=-=-=- METHODS -=-=-=-=-

' mmOpen Filename Opens the requested filename

' mmClose Closes the current file

' mmPause Pauses playback of the current file

' mmStop Stops playback ready for closedown

' mmSeek Position Seeks to a position in the file

' mmPlay Plays the open file

'-------------------------------------------------------------

' NOTES

' -----

'

' Open a file, then play it. Pause it in response to a request

' from the user. Stop if you intend to seek to the start and

' play again. Close when you no longer want to play the file

'--------------------------------------------------------------

Private sAlias As String ' Used internally to give an alias name to

' the multimedia resource

Private sFilename As String ' Holds the filename internally

Private nLength As Single ' Holds the length of the filename

' internally

Private nPosition As Single ' Holds the current position internally

Private sStatus As String ' Holds the current status as a string

Private bWait As Boolean ' Determines if VB should wait until play

' is complete before returning.

'------------ API DECLARATIONS -------------

'note that this is all one code line:

Private Declare Function mciSendString Lib "winmm.dll" _

Alias "mciSendStringA" (ByVal lpstrCommand As String, _

ByVal lpstrReturnString As String, ByVal uReturnLength As Long, _

ByVal hwndCallback As Long) As Long

Public Sub mmOpen(ByVal sTheFile As String)

' Declare a variable to hold the value returned by mciSendString

Dim nReturn As Long

' Declare a string variable to hold the file type

Dim sType As String

' Opens the specified multimedia file, and closes any

' other that may be open

If sAlias "" Then

mmClose

End If

' Determine the type of file from the file extension

Select Case UCase$(Right$(sTheFile, 3))

Case "WAV"

sType = "Waveaudio"

Case "AVI"

sType = "AviVideo"

Case "MID"

sType = "Sequencer"

Case Else

' If the file extension is not known then exit the subroutine

Exit Sub

End Select

sAlias = Right$(sTheFile, 3) Minute(Now)

' At this point there is no file open, and we have determined the

' file type. Now would be a good time to open the new file.

' Note: if the name contains a space we have to enclose it in quotes

If InStr(sTheFile, " ") Then sTheFile = Chr(34) sTheFile Chr(34)

nReturn = mciSendString("Open " sTheFile " ALIAS " sAlias _

" TYPE " sType " wait", "", 0, 0)

End Sub

Public Sub mmClose()

' Closes the currently opened multimedia file

' Declare a variable to hold the return value from the mciSendString

' command

Dim nReturn As Long

' If there is no file currently open then exit the subroutine

If sAlias = "" Then Exit Sub

nReturn = mciSendString("Close " sAlias, "", 0, 0)

sAlias = ""

sFilename = ""

End Sub

Public Sub mmPause()

' Pause playback of the file

' Declare a variable to hold the return value from the mciSendString

' command

Dim nReturn As Long

' If there is no file currently open then exit the subroutine

If sAlias = "" Then Exit Sub

nReturn = mciSendString("Pause " sAlias, "", 0, 0)

End Sub

Public Sub mmPlay()

' Plays the currently open file, from the current position

' Declare a variable to hold the return value from the mciSendString

' command

Dim nReturn As Long

' If there is no file currently open, then exit the routine

If sAlias = "" Then Exit Sub

' Now play the file

If bWait Then

nReturn = mciSendString("Play " sAlias " wait", "", 0, 0)

Else

nReturn = mciSendString("Play " sAlias, "", 0, 0)

End If

End Sub

Public Sub mmStop()

' Stop using a file totally, be it playing or whatever

' Declare a variable to hold the return value from mciSendString

Dim nReturn As Long

' If there is no file currently open then exit the subroutine

If sAlias = "" Then Exit Sub

nReturn = mciSendString("Stop " sAlias, "", 0, 0)

End Sub

Public Sub mmSeek(ByVal nPosition As Single)

' Seeks to a specific position within the file

' Declare a variable to hold the return value from the mciSendString

' function

Dim nReturn As Long

nReturn = mciSendString("Seek " sAlias " to " nPosition, "", 0, 0)

End Sub

Property Get Filename() As String

' Routine to return a value when the programmer asks the

' object for the value of its Filename property

Filename = sFilename

End Property

Property Let Filename(ByVal sTheFile As String)

' Routine to set the value of the filename property, should the programmer

' wish to do so. This implies that the programmer actually wants to open

' a file as well so control is passed to the mmOpen routine

mmOpen sTheFile

End Property

Property Get Wait() As Boolean

' Routine to return the value of the object's wait property.

Wait = bWait

End Property

Property Let Wait(bWaitValue As Boolean)

' Routine to set the value of the object's wait property

bWait = bWaitValue

End Property

Property Get Length() As Single

' Routine to return the length of the currently opened multimedia file

' Declare a variable to hold the return value from the mciSendString

Dim nReturn As Long, nLength As Integer

' Declare a string to hold the returned length from the mci Status call

Dim sLength As String * 255

' If there is no file open then return 0

If sAlias = "" Then

Length = 0

Exit Property

End If

nReturn = mciSendString("Status " sAlias " length", sLength, 255, 0)

nLength = InStr(sLength, Chr$(0))

Length = Val(Left$(sLength, nLength - 1))

End Property

Property Let Position(ByVal nPosition As Single)

' Sets the Position property effectively by seeking

mmSeek nPosition

End Property

Property Get Position() As Single

' Returns the current position in the file

' Declare a variable to hold the return value from mciSendString

Dim nReturn As Integer, nLength As Integer

' Declare a variable to hold the position returned

' by the mci Status position command

Dim sPosition As String * 255

' If there is no file currently opened then exit the subroutine

If sAlias = "" Then Exit Property

' Get the position and return

nReturn = mciSendString("Status " sAlias " position", sPosition, 255, 0)

nLength = InStr(sPosition, Chr$(0))

Position = Val(Left$(sPosition, nLength - 1))

End Property

Property Get Status() As String

' Returns the playback/record status of the current file

' Declare a variable to hold the return value from mciSendString

Dim nReturn As Integer, nLength As Integer

' Declare a variable to hold the return string from mciSendString

Dim sStatus As String * 255

' If there is no file currently opened, then exit the subroutine

If sAlias = "" Then Exit Property

nReturn = mciSendString("Status " sAlias " mode", sStatus, 255, 0)

nLength = InStr(sStatus, Chr$(0))

Status = Left$(sStatus, nLength - 1)

End Property

//窗體fm

Dim m As New Mmedia

Dim fn

Private Sub Command1_Click()

On Error GoTo r

dlg.ShowOpen

fn = dlg.Filename

m.mmOpen fn

r:

If Err Then MsgBox Err.Description

End Sub

Private Sub Command2_Click()

On Error GoTo rp

m.mmPlay

rp:

If Err Then MsgBox Err.Description

End Sub

Private Sub Command3_Click()

On Error GoTo rap

m.mmPause

rap:

If Err Then MsgBox Err.Description

End Sub

Private Sub Command4_Click()

On Error GoTo racp

m.mmStop

racp:

If Err Then MsgBox Err.Description

End Sub

用VB.NET編多媒體播放器

我這里有一段前段時(shí)間寫(xiě)的測(cè)試代碼,使用WMPLib類,中間有你需要的功能,你可以參考下:

使用wmp.currentMedia.duration和wmp.currentMedia.durationString分別以double和string獲得當(dāng)前媒體的播放時(shí)間,使用wmp.settings.volume設(shè)置音量大小,使用wmp.controls.currentPosition設(shè)置當(dāng)前播放時(shí)間點(diǎn)

Imports WMPLib

Public Class FrmMain

Dim WithEvents wmp As WMPLib.WindowsMediaPlayer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

wmp = New WMPLib.WindowsMediaPlayer()

TextBox1.Text = TextBox1.Text vbCrLf "當(dāng)前播放狀態(tài):" wmp.status

wmp.uiMode = "Mini"

wmp.settings.balance = 1

wmp.enableContextMenu = True

wmp.fullScreen = False

wmp.windowlessVideo = True

wmp.enabled = True

Dim wmpMediaList As IWMPPlaylist = wmp.newPlaylist("默認(rèn)播放列表", "")

Dim wmpMedia As IWMPMedia = wmp.newMedia(My.Computer.FileSystem.CurrentDirectory "\Human.mp3")

With wmpMediaList

.appendItem(wmpMedia)

End With

'wmp.URL = "\\192.168.1.247\sharoncn\music\Human.mp3"

wmp.currentMedia = wmpMedia

wmp.settings.autoStart = True

tBarPlay.Value = 0

ListBox1.Items.Add(wmpMediaList.name)

ListBox1.SelectedIndex = 0

ListBox2.Items.Add(wmpMediaList.Item(0).name)

ListBox2.SelectedIndex = 0

tbar.Maximum = 100

tbar.Value = 50

Timer1.Enabled = True

Timer1.Interval = 100

End Sub

Private Sub wmp_PlayStateChange(ByVal NewState As Integer) Handles wmp.PlayStateChange

tBarPlay.Maximum = wmp.currentMedia.duration * 10

Label1.Text = "總時(shí)間:" wmp.currentMedia.durationString

TextBox1.Text = TextBox1.Text vbCrLf "當(dāng)前播放狀態(tài):" NewState

If NewState = 1 Then

wmp.controls.play()

End If

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

TextBox1.SelectionStart = Len(TextBox1.Text)

TextBox1.ScrollToCaret()

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Label2.Text = "當(dāng)前播放進(jìn)度:" wmp.controls.currentPositionString

tBarPlay.Value = CInt(wmp.controls.currentPosition * 10)

End Sub

Private Sub tbar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbar.Scroll

wmp.settings.volume = tbar.Value

End Sub

Private Sub tBarPlay_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tBarPlay.Scroll

wmp.controls.currentPosition = tBarPlay.Value / 10

End Sub

End Class

vb.net制作 mp3播放器

用VB制作一個(gè)簡(jiǎn)單的MP3播放器

用VB制作一個(gè)簡(jiǎn)單的MP3播放器 利用API函數(shù)[mciSendString]可以輕松實(shí)現(xiàn)MP3音樂(lè)文件的播放。下面這段程序?qū)崿F(xiàn)了MP3播放的大部分常規(guī)操作,對(duì)其稍加修改,做一個(gè)100KB大小的MP3播放器輕而易舉

啟動(dòng)VB程序,在窗體上放置6個(gè)命令按鈕,三個(gè)標(biāo)簽,一個(gè)公用對(duì)話框、一個(gè)進(jìn)度條、一個(gè)狀態(tài)欄和一個(gè)計(jì)時(shí)器,窗本的布置請(qǐng)參考附圖按鈕"Open MP3 File"是用來(lái)打開(kāi)對(duì)話框選擇MP3文件,其他5個(gè)按鈕分別為Play(播放)、Pause(暫停)、Stopplay(停止播放)、Back(向后跳躍)、Prew(向前跳躍)。Label1用來(lái)表示歌曲當(dāng)前時(shí)間;label2放在時(shí)度條的最左邊,Caption屬性為"00:00";lable3放在時(shí)度條的右邊,用來(lái)表示歌曲總長(zhǎng)。下面就可以編寫(xiě)代碼了。首先在窗體的"通用聲明"部分聲明函數(shù)

Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA"(Byval lpstrCommand As String,ByVal lpstrRetumString As String,ByVal uReturnLength As long,ByVal hwndCallback as long) As longDim mfn As String

下面就是各個(gè)對(duì)象的代碼了:

Private Sub Form_load()

mfn=""

play.Enabled=False

pause.Enabled=False

Stopplay.Enabled=False

back.Enabled=False

prew.Enabled=False

Timer1.Enabled=False

Timer1.Interval=500

End SubPrivate Sub open_Click()

On Error Goto err

With CommonDialog1

.CancelError=True

.Filter="音樂(lè)文件|*.mp3;*.wav;*.mid"

.Flags=cdlOFNNoChangeDir And cdlOFNPathMustExist

.Action=1

stopplay_Click '停止按鈕同時(shí)可以設(shè)備初始化

mfn=.FileName '這個(gè)程序中文件名一定不能帶空格

Form1.Caption=.FileName

play.Enabled=True

End With

play_Click

Exit Sub

err:

End SubPrivate Sub play_Click()

On Error Resume Next

Dim t As Long

t=mciSendString("open " + mfn,0,0,0) 'Open后邊的空格一定不能丟

Dim ret As String * 128

t=mciSendString("status " + mfn + " length",ret,128,0)

'顯示歌曲總長(zhǎng)

ret=Left(ret,8)

If ret"" Then

ProgressBar1.Min=0

ProgressBar1.Max=Val(ret)

Label3.Caption=gettime(Val(ret))

End If

play.Enabled=False

pause.Enabled=True

stopplay.Enabled=True

back.Enabled=True

prew.Enabled=True

t=mciSendString("status " + mfn +" mode",ret,128,0)

'得到設(shè)備的當(dāng)前狀態(tài),是播放還是暫停等等

ret=Left(ret,8)

StatusBar1.Panels(1).text=ret

'在狀態(tài)欄顯示播放狀態(tài)

t=mciSendString("play " + mfn + " form " + Str(ProgressBar1.Value),0,0,0)

'開(kāi)始播放

Timer1.Enabled=True

End Sub

Private Sub pause_Click()

t%=mciSendString("pause " + mfn,0,0,0)

'發(fā)出暫停的命令

play.Enable=True

pause.Enabled=False

stopplay.Enabled=True

back.Enabled=False

prew.Enabled=False

End Sub

Private Sub stopplay_Click()

t%=mciSendString("stop " + mfn,0,0,0)

t%=mciSendString("close " + mfn,0,0,0)

'停止播放

play.Enabled=True

pause.Enabled=False

stopplay.Enabled=False

back.Enabled=False

prew.Enabled=False

End Sub

Private Sub back_Click()

t%=mciSendString("play " + mfn + " from " + Str(ProgressBar1.Value-(ProgressBar1.Max\10)),0,0,0) '向后跳一小段再播放

End Sub

Private Sub prew_Click()

t%=mciSendString("play " + mfn + " from " + Stri(ProgressBar1.Value+(ProgressBar1.Max\10)),0,0,0) '向前跳一小段再播放

End Sub

Private Sub Timer1_Timer()

Dim t As Long

Dim ret As String * 128

t=mciSendString("status " + mfn + " position",ret,0,0)

'得到當(dāng)前播放位置

ret=left(ret,8)

ProgressBar1.Value=Val(ret)

Label1.Caption=gettime(Val(ret))

'顯示歌曲當(dāng)前時(shí)間

If ProgressBar1.Value=ProgressBar1.Max Then

stopplay_Click

End If

t=mciSendString("status " + mfn + " mode",ret,128,0)

ret=Left(ret,8)

StatusBar1.Panels(1).Text=ret

End SubPrivate Sub Form_Unload(Cacel As Integer)

t%=mciSendString("stop " + mfn,0,0,0)

t%=mciSendString("close " + mfn,0,0,0)

End SubPrivate Function Gettime(position As Long) As String

'這個(gè)函數(shù)的功能是把以長(zhǎng)整型表示的時(shí)間轉(zhuǎn)換為電子鐘式的"**:**"

Dim min,sec

min=position/1000

min=min/60

sec=min-Int(min)

min=Int(min)

sec=60 * sec / 100

sec=Int(sec * 100)

gettime=Str(min) + ":" + Str(sec)

End Function

網(wǎng)站欄目:vb.net播放器,vb播放器控件
分享網(wǎng)址:http://chinadenli.net/article44/hchdhe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)移動(dòng)網(wǎng)站建設(shè)虛擬主機(jī)搜索引擎優(yōu)化Google網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)