-
-
[已解决,谢谢!]请问关于用ufmod给VB加XM音乐的问题
-
2006-7-4 16:32
5094
-
[已解决,谢谢!]请问关于用ufmod给VB加XM音乐的问题
下载了论坛上的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直播授课