首页
社区
课程
招聘
[已解决,谢谢!]请问关于用ufmod给VB加XM音乐的问题
2006-7-4 16:32 5094

[已解决,谢谢!]请问关于用ufmod给VB加XM音乐的问题

2006-7-4 16:32
5094
下载了论坛上的ufmod,准备给VB加个XM格式的背景音乐。
ufmod里的的示例是用MessageBox,但是我改成用Form1就出错,
不知应该更改哪些地方,请知道的兄弟指点一下!谢谢!
以下是其中的部分代码:
' Get an instance of DirectSound
DirectSoundCreate ByVal 0&, ds, Nothing

' Normally, you whould specify a handle to your own form,
' but since we don't have one in this project, we'll grab
' the foreground window handle instead
ds.SetCooperativeLevel GetForegroundWindow(), DSSCL_PRIORITY

' Create a secondary sound buffer for playback
ds.CreateSoundBuffer bufferDesc, dsb, Nothing

' Start playback
' 1 is the ID of the XM resource
hresult = uFMOD_DSPlaySong(1, App.hInstance, XM_RESOURCE, dsb)
If hresult < 0 Then Err.Rise hresult

' Pop-up a message box to let uFMOD play the XM till user input
MsgBox "uFMOD ruleZ!", vbOKOnly, ".:Visual Basic:."

' Stop playback
uFMOD_DSPlaySong 0, 0, 0, Nothing

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
点赞0
打赏
分享
最新回复 (2)
雪    币: 560
活跃值: (309)
能力值: ( LV13,RANK:1370 )
在线值:
发帖
回帖
粉丝
laomms 34 2006-7-4 17:39
2
0
直接在窗体中调用:
Private Sub Form_Initialize()
   ' Start playback
   '    1 is the ID of the XM resource
    uFMOD_PlaySong 1, App.hInstance, XM_RESOURCE
End Sub
雪    币: 267
活跃值: (44)
能力值: ( LV9,RANK:330 )
在线值:
发帖
回帖
粉丝
hrbx 8 2006-7-4 17:57
3
0
谢谢laomms指点,去试试!
游客
登录 | 注册 方可回帖
返回