Keywords: DirectX9 DirectSound VB.NET Author: Dong-containing source code online to see the king is in C , C # is also the best of intentions, and to baidu search and found so many people looking at 9CBS think there is a blog. I hope to share it with you. 3-17 is going to examine, it is estimated that it will continue to study for a long time. About VB6 enthusiasts. Everyone will give up VB6 as soon as possible, I started in 1997, now finally It is also .NET, the middle of the pain can be imagined. Especially the server programming, .NET will be much convenient. With the upgrade of XP with Windows Update, it is not ready. My Learning method looks at the SDK documentation, understands many concepts, then look at the SDK C # tutorial (I have been used to it) Prepare VS2003 (with 2002, but don't use that version) Dxsdk 9.0c 2004 dec (Remember, is for vs2k3, once With VS2K2, and many places are not universal) Win2K (this long time no need to say) Multi-step 1 first add a reference. Otherwise, IMPORTS can't find Microsoft.directX .... 2 Quote, for convenience, IMPORTS Microsoft .Directx.directSound To play a simple sound file to create a device, create a device, create a buffer, specify the source (here file) Play ... DIM AD As Device 'creation device DIM BUF As SecondaryBuffer' Create buffer Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ad = New device 'strength of the device object ad.SetCooperativeLevel (Me.Handle, CooperativeLevel.Normal)' associated Buf = New SecondaryBuffer ("G: /Media/wav/ff9start.wav", AD) 'Strengthens buffer buf.play (0, bufferplayflags.looping "play, and specifying the start position and mode End Sub This is the most basic simplest. Example, the purpose is to understand the interesting phenomenon of the steps Since the DS is associated with the form, when the form loses the focus, he stopped playing once to re-focus, it is convenient to play, but the DS is used by the buffer. When switching, it will lose sound, less So a little SDK mentioned, but I didn't care seriously (1 I feel that there is no big problem (unless recording) 2 English, lazy ~) actually does not have to solve the problem, because of the BUF description, this option is ordinary (that it is the default, which I use) Sticky see the original bar: Buffers with / "sticky /" focus will continue to play if the user switches to another application not using DirectSound However, if the user switches to another DirectSound application. All Normal-Focus and Sticky-Focus Buffers in the PreviOS Application Are Muted.