6 Years
Discussion Span
Last Post by wvusaf

Your post will be moved to the .net forum, this is vb4/5/6

To your question, add a windows media player to your splash screen with the following code -

    Me.wmp.Visible = True
    Me.wmp.FileName= "C:\SystemSecurity\SystemSecurity\HelpVedio\
            Me.wmp.Width = 1000
            Me.wmp.Height = 800
            Me.WindowState = FormWindowState.Maximized
        Catch err As Exception
            MsgBox("Invalid Input", MsgBoxStyle.Critical)
        End Try

ive already write it into the splash screen form load..but there is an error in line 5 where play is not the member of axWMPLib.WMP..

ps:how do i remove this thread to .net forum? quite new here..


I have already asked the moderators to move this post.

I will post a solution in a few minutes.:)


sorry, i dont think that i understand the walkthrough that u provided..

dont know what is "To host the ActiveX control"


You need to create an instance of the mediaplayer BEFORE you can use it.

' Create the ActiveX control.
    Dim awmp As New AxWMPLib.AxWindowsMediaPlayer()

You must also make sure that the axWMPLibrary is referenced in your application.

Now add the code I have supplied above and let me know if this solved your problem.:)


ive added the activeX control in the module level of the form..then the error still appeard at the line 5..stated that play is not the member of wmp library


after i enter the code in the splash screen, this problem appeared after i press debug

"Cross-thread operation not valid: Control 'MainLayoutPanel' accessed from a thread other than the thread it was created on"



Your "MainLayoutPanel" in your application was accessed or referenced from another app etc. This is fixable though, don't worry.

Have a look at this thread HERE.It gives you a step by step on how to get to the path where the thread was created.


Alright, any word on a solution to this. I get the same 'Cross-thread operation not valid:' error. When you use the Application Framework in VB.NET and set a Splash screen, you cannot add an AxWindowsMediaPlayer control to play a video without getting the cross-thread operation error. Is it possible to play a video using a AxWindowsMediaPlayer control on another thread?


It's easy to reproduce. You don't even have to write any code yourself.
Create a VB.NET Windows Forms app.
Add a Splash Screen to the project.
Add a AxWindowsMediaPlayer control to the splash screen.
Open the project properties and make sure 'Enable application framework' is checked.
Set the Splash screen: dropdown to the splash screen you added.
Run the project and you'll get an InvalidOperationException that says "Cross-thread operation not valid: Control 'SplashScreen1' accessed from a thread other than the thread it was created on."

and here is the StackTrace, which is all Framework code, so there seems to be no possible way to fix it:

at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DisplaySplash()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


Have you created your splash screen from scratch or did you copy it from another project? The error is not on the player, but on the splash screen.


I just added a Splash Screen project item. it could be any form. any form that you set to be the splash screen for the project will give you this error if it has a media player control on the form.


It seems that you are trying to access another thread other than the thread you are in.

Have a look at THIS thread with the exact same error and the solution.


no, i'm not trying to access anything on my own. i didn't write one line of code in this project. i did everything with the designer. the framework itself is trying to access the splash screen from another thread. this only happens when a media player control is on a form that is the splash screen. when using the Application Framework, a splash screen is loaded on a worker thread automatically.

Edited by wvusaf: n/a


Then I am at a loss for words. It obviously has to do with the design properties set on either the form or the player if there is absolutely no code behind it.

I'll search some more and see what I can find for you.


It has something to do with how the Application Framework is trying to get a handle to the splashscreen form to show it before the main form comes up. i can get a handle when there is not a windows media player control on the splashscreen form but an exception is thrown when there is one.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.