C# application of windows media player.

  • 10 years ago

    When media player finishes playing music in second form, it should close the second form and show h first form, but it is throwing error in first form called Display:

    static void Main()
     Application.Run(new Display());

    Error is as follows:

    This following error is thrown::::::
    'System.Runtime.InteropServices.SEHException' occurred in system.windows.forms.dll.Additional information: External component has thrown an exception.at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

    at System.Windows.ThreadContext.RunMessageLoopInner(Int32 reason,ApplicationContext context)
    at System.Windows.ThreadContext.RunMessageLoop(Int32 reason,ApplicationContext context)
    at System.Windows.Forms.Application.Run(Form mainForm)
    at <SolutionName>.Display.Main()

    This is the event fired when media player finishes playing music:
    private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
                            if (e.newState  == (int(WMPLib.WMPPlayState.wmppsStopped))

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila” - Mitch Ratcliffe