Recieved this question in mail:
I am a novice programmer, and am having difficulty in using “Playing a Sound”.
I know I am certainly still a novice compared to some of my coworkers!
I was playing with writing a game in GDI+ (probably not something I would recommend for a commercial gamer) and used the code below to play sounds for my version of battlezone…
Bill points out in Visual Studio 2005 it is even easier
In either case you should come along to the local user group http://www.qmsdnug.org …they typically have both an advanced and intro session.
Dim ptr As New IntPtr()
Dim uint As New UInt32()
sound.PlaySound(“C:\arcade\bz10.wav”, ptr, uint)
Public Class sound
Declare Auto Sub PlaySound Lib “winmm.dll” (ByVal pszSound As String, ByVal hmod As IntPtr, ByVal fdwSound As UInt32)
‘SND_SYNC = 0x0000,
‘ SND_ASYNC = 0x0001,
‘ SND_NODEFAULT = 0x0002,
‘ SND_MEMORY = 0x0004,
‘ SND_LOOP = 0x0008,
‘ SND_NOSTOP = 0x0010,
‘ SND_NOWAIT = 0x00002000,
‘ SND_ALIAS = 0x00010000,
‘ SND_ALIAS_ID = 0x00110000,
‘ SND_FILENAME = 0x00020000,
‘ SND_RESOURCE = 0x00040004
Frank also pointed out there are tons of great resources for these type of querstions:
First, let me point you to some great information to learn all about vb.net 2005. http://msdn.microsoft.com/vbrun/staythepath/ which includes a free book about ugrading from vb6 to vb.net http://msdn.microsoft.com/vbrun/staythepath/additionalresources/upgradingvb6/default.aspx