mid音乐能否加入到所生成的.EXE文件中?
在VB编程时我用*.mid音乐作为背景文件,用MediaPlayer控件播放。
如何才能把*.mid文件一起生成.EXE文件,而不必单附在外部?
问题点数:100、回复次数:8Top
1 楼daisy8675(莫依 沉迷)回复于 2004-10-03 20:02:02 得分 10
不能加入
请打包Top
2 楼cso(无聊中...)回复于 2004-10-03 20:16:20 得分 15
可以作为资源使用
播放资源文件文件中的声音
http://www.sijiqing.com/vbgood/article/00119954.htmlTop
3 楼itcoco(椰子)回复于 2004-10-03 21:24:27 得分 20
请问资源文件的源文件(RC)是vb工程中哪个文件呀〉?
//1.播放资源文件文件中的声音
VB 提供的方法使我们可以很容易地使用资源文件中的字符、图片等资源。我们可以用以
下方法播放资源文件中的 wav 声音:
首先,在你的资源文件的源文件 (RC) 文件加入下面一行:
MySound WAVE c:\music\vanhalen.wav
然后将其编译为 RES 文件。最后使用下面的声明及代码:
Private Declare Function PlaySound Lib _ "winmm.dll" Alias "PlaySoundA" ( _
ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Private Const SND_ASYNC& = &H1
Private Const SND_NODEFAULT& = &H2
Private Const SND_RESOURCE& = &H40004
Dim hInst As Long
Dim sSoundName As String
Dim lFlags As Long
Dim lRet As Long
Private Sub Command1_Click()
hInst = App.hInstance
sSoundName = "MySound"
lFlags = SND_RESOURCE + SND_ASYNC + _ SND_NODEFAULT
lRet = PlaySound(sSoundName, hInst, lFlags)
End Sub
Top
4 楼yuyes(无业游民)回复于 2004-10-03 22:52:22 得分 10
使用资源文件.rcTop
5 楼lxcc()回复于 2004-10-04 01:37:44 得分 10
VB资源的使用方法
http://www.cfanclub.net/new_cxsj/040303017.htm
http://www.suxw.com/asp_bin/winopen.asp?ID=374Top
6 楼dongge2000(目前叫西西了)回复于 2004-10-04 12:11:57 得分 15
Public Function WirteRes(ByVal ResID As String, ByVal ResType As String, ByVal PathFile As String) As Boolean
Dim f As Integer
f = FreeFile
Dim MyExe() As Byte
MyExe = LoadResData(ResID, ResType)
Open PathFile For Output As #f
Close #f
Open PathFile For Binary As #f
Put #f, , MyExe
Close #f
Erase MyExe
End Function
'IF WirteRes("MyExe","RES","F:\MyExe.exe") Then
大概就是了。Top
7 楼j_x_y(稀里糊涂)回复于 2004-10-06 14:17:06 得分 10
作为资源Top
8 楼jam021(jam)回复于 2004-10-09 13:28:20 得分 10
关注,帮你顶!Top




