The .NET Compact Framework comes with a set of new classes and functionality. One of the new classes I'd like to talk about is the SoundPlayer. Before 3.5 it was not possible to play sound without using some P/Invoke methods. But unfortunately the SoundPlayer class has one big limitation; it can only play *.wav files.
So here is a piece of code which uses P/Invoke to play MP3 files as well:
Imports System.Runtime.InteropServices
Public Class SoundPlayer
Private hSound As IntPtr = IntPtr.Zero
<DllImport("aygshell.dll")> _
Public Shared Function SndOpen(ByVal pszSoundFile As String, ByRef phSound As IntPtr) As Integer
End Function
<DllImport("aygshell.dll")> _
Public Shared Function SndPlayAsync(ByVal hSound As IntPtr, ByVal dwFlags As Integer) As Integer
End Function
<DllImport("aygshell.dll")> _
Public Shared Function SndClose(ByVal hSound As IntPtr) As Integer
End Function
<DllImport("aygshell.dll")> _
Public Shared Function SndStop(ByVal SoundScope As Integer, ByVal hSound As IntPtr) As Integer
End Function
Public Sub Play(ByVal FileName As String)
SndOpen(FileName, hSound)
SndPlayAsync(hSound, 0)
End Sub
Public Sub [Stop]()
SndClose(hSound)
SndStop(1, IntPtr.Zero)
End Sub
End Class
A while ago I posted an item about Visual Studio 2008 Power Commands. Although it really adds some nice features to the IDE it also added a less nice feature. It turned out that Power Commands was able to let Visual Studio 2008 crash.
I wanted to add some items to the toolbox, so I clicked on the 'Choose Items' menu item in the contextmenu of the toolbox. After a few seconds of loading the active instance of Visual Studio was closed.
The following error was logged into the Event Logs:
.NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (66DE5E00) (80131506)
After reading a bit on the Internet it turned out that Power Commands could be source. After removing Power Commands the issue was disappeared as well.
Power Commands is still in development, however there hasn't been a lot of activity lately. You can get the latest version here.