PDA

View Full Version : حرفه ای: پخش آهنگ توسط توابع API



m.4.r.m
پنج شنبه 02 شهریور 1391, 10:46 صبح
Option Explicit

'*-------------------------------------*
'* Playsound flags: store in dwFlags *
'*-------------------------------------*
' lpszName points to a registry entry
' Do not use SND_RESOURSE or SND_FILENAME
Private Const SND_ALIAS& = &H10000
' Playsound returns immediately
' Do not use SND_SYNC
Private Const SND_ASYNC& = &H1
' The name of a wave file.
' Do not use with SND_RESOURCE or SND_ALIAS
Private Const SND_FILENAME& = &H20000
' Unless used, the default beep will
' play if the specified resource is missing
Private Const SND_NODEFAULT& = &H2
' Fail the call & do not wait for
' a sound device if it is otherwise unavailable
Private Const SND_NOWAIT& = &H2000
' Use a resource file as the source.
' Do not use with SND_ALIAS or SND_FILENAME
Private Const SND_RESOURCE& = &H40004
' Playsound will not return until the
' specified sound has played. Do not
' use with SND_ASYNC
Private Const SND_SYNC& = &H0

Public Enum enSound_Source
ssFile = SND_FILENAME&
ssRegistry = SND_ALIAS&
End Enum

' These are common sounds available from the registry
Public Const elDefault = ".Default"
Public Const elGPF = "AppGPFault"
Public Const elClose = "Close"
Public Const elEmptyRecycleBin = "EmptyRecycleBin"
Public Const elMailBeep = "MailBeep"
Public Const elMaximize = "Maximize"
Public Const elMenuCommand = "MenuCommand"
Public Const elMenuPopUp = "MenuPopup"
Public Const elMinimize = "Minimize"
Public Const elOpen = "Open"
Public Const elRestoreDown = "RestoreDown"
Public Const elRestoreUp = "RestoreUp"
Public Const elSystemAsterisk = "SystemAsterisk"
Public Const elSystemExclaimation = "SystemExclaimation"
Public Const elSystemExit = "SystemExit"
Public Const elSystemHand = "SystemHand"
Public Const elSystemQuestion = "SystemQuestion"
Public Const elSystemStart = "SystemStart"

Private Declare Function PlaySound& Lib "winmm.dll" Alias_
"PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, _
ByVal dwFlags As Long)
' hModule is only used if SND_RESOURCE& is set and represents
' an HINSTANCE handle. This example doesn't support playing
' from a resource file.


' Plays sounds from the registry or a disk file
' Doesn't care if the file is missing
Public Function EZPlay(ssname As String, _
sound_source As enSound_Source) As Boolean

If PlaySound(ssname, 0&, sound_source + _
SND_ASYNC + SND_NODEFAULT) Then
EZPlay = True
Else
EZPlay = False
End If

End Function

program2vb
جمعه 03 شهریور 1391, 19:17 عصر
سلام دوست عزیز با اینم (http://barnamenevis.org/showthread.php?354986-%DA%AF%D8%B0%D8%A7%D8%B4%D8%AA%D9%86-%D8%B5%D8%AF%D8%A7-%D8%A8%D8%B1-%D8%B1%D9%88%DB%8C-%D9%81%D8%B1%D9%85&p=1564850&viewfull=1#post1564850) میتونی آهنگ و فیلم پخش کنی امکاناتش زیاده .....

موفق و پیروز باشی .... یا علی

MohammadGh2011
جمعه 03 شهریور 1391, 20:39 عصر
Option Explicit

'*-------------------------------------*
'* Playsound flags: store in dwFlags *
'*-------------------------------------*
' lpszName points to a registry entry
' Do not use SND_RESOURSE or SND_FILENAME
Private Const SND_ALIAS& = &H10000
' Playsound returns immediately
' Do not use SND_SYNC
Private Const SND_ASYNC& = &H1
' The name of a wave file.
' Do not use with SND_RESOURCE or SND_ALIAS
Private Const SND_FILENAME& = &H20000
' Unless used, the default beep will
' play if the specified resource is missing
Private Const SND_NODEFAULT& = &H2
' Fail the call & do not wait for
' a sound device if it is otherwise unavailable
Private Const SND_NOWAIT& = &H2000
' Use a resource file as the source.
' Do not use with SND_ALIAS or SND_FILENAME
Private Const SND_RESOURCE& = &H40004
' Playsound will not return until the
' specified sound has played. Do not
' use with SND_ASYNC
Private Const SND_SYNC& = &H0

Public Enum enSound_Source
ssFile = SND_FILENAME&
ssRegistry = SND_ALIAS&
End Enum

' These are common sounds available from the registry
Public Const elDefault = ".Default"
Public Const elGPF = "AppGPFault"
Public Const elClose = "Close"
Public Const elEmptyRecycleBin = "EmptyRecycleBin"
Public Const elMailBeep = "MailBeep"
Public Const elMaximize = "Maximize"
Public Const elMenuCommand = "MenuCommand"
Public Const elMenuPopUp = "MenuPopup"
Public Const elMinimize = "Minimize"
Public Const elOpen = "Open"
Public Const elRestoreDown = "RestoreDown"
Public Const elRestoreUp = "RestoreUp"
Public Const elSystemAsterisk = "SystemAsterisk"
Public Const elSystemExclaimation = "SystemExclaimation"
Public Const elSystemExit = "SystemExit"
Public Const elSystemHand = "SystemHand"
Public Const elSystemQuestion = "SystemQuestion"
Public Const elSystemStart = "SystemStart"

Private Declare Function PlaySound& Lib "winmm.dll" Alias_
"PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, _
ByVal dwFlags As Long)
' hModule is only used if SND_RESOURCE& is set and represents
' an HINSTANCE handle. This example doesn't support playing
' from a resource file.


' Plays sounds from the registry or a disk file
' Doesn't care if the file is missing
Public Function EZPlay(ssname As String, _
sound_source As enSound_Source) As Boolean

If PlaySound(ssname, 0&, sound_source + _
SND_ASYNC + SND_NODEFAULT) Then
EZPlay = True
Else
EZPlay = False
End If

End Function

سلام عليکم
لطفا قبل از ايجاد تاپيک نوع تاپيک رو مشخص کنيد.( سوال،خبر،گفتگو و ... :eg)


موفق باشيد

m.4.r.m
شنبه 04 شهریور 1391, 10:26 صبح
سلام عليکم
لطفا قبل از ايجاد تاپيک نوع تاپيک رو مشخص کنيد.( سوال،خبر،گفتگو و ... :eg)


موفق باشيد

به چیز دیگه ای نتونستی گیر بدی ؟