473,378 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Playing swf in C#

19
Hello,

I'm trying to play a swf movie into my C# winform application.

I've added the references "AxInterop.ShockwaveFlashObjects" and "Interop.ShockwaveFlashObjects".

When I start the application, the following error message is catched: "Property set of 'Movie' cannot be invoked at this time."

I also receive the following error:
Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateEx ception' was thrown.

Here is a part of the code:
Expand|Select|Wrap|Line Numbers
  1.  internal AxShockwaveFlash[] myFlash = new AxShockwaveFlash[MaxScreens];
  2.  
  3.   myFlash[i] = new AxShockwaveFlash();
  4.   myFlash[i].Movie = Application.StartupPath + @"cloudstorm1.swf";
  5.  
  6.  
Could you please advise ?

Thank you
Aug 19 '11 #1

✓ answered by siilexx

I've finally found a solution:

Expand|Select|Wrap|Line Numbers
  1. myFlash[i] = new AxShockwaveFlashObjects.AxShockwaveFlash();
  2. ((System.ComponentModel.ISupportInitialize)(this.myFlash[i])).BeginInit();
  3.  
  4. System.ComponentModel.ComponentResourceManager resourcess =    new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
  5. this.myFlash[i].OcxState = ((System.Windows.Forms.AxHost.State)(resourcess.GetObject("myFlash[" + i + "].OcxState")));
  6.  
  7. this.Controls.Add(this.myFlash[i]);
  8. ((System.ComponentModel.ISupportInitialize)(this.myFlash[i])).EndInit();
  9.  
  10. PanelHeader[i].Controls.Add(myFlash[i]);               
  11. myFlash[i].Dock = DockStyle.Fill;                 
  12. myFlash[i].EmbedMovie = true;
  13. myFlash[i].Movie = Application.StartupPath + @"\cloudstorm1.swf";   
  14.  

1 4449
siilexx
19
I've finally found a solution:

Expand|Select|Wrap|Line Numbers
  1. myFlash[i] = new AxShockwaveFlashObjects.AxShockwaveFlash();
  2. ((System.ComponentModel.ISupportInitialize)(this.myFlash[i])).BeginInit();
  3.  
  4. System.ComponentModel.ComponentResourceManager resourcess =    new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
  5. this.myFlash[i].OcxState = ((System.Windows.Forms.AxHost.State)(resourcess.GetObject("myFlash[" + i + "].OcxState")));
  6.  
  7. this.Controls.Add(this.myFlash[i]);
  8. ((System.ComponentModel.ISupportInitialize)(this.myFlash[i])).EndInit();
  9.  
  10. PanelHeader[i].Controls.Add(myFlash[i]);               
  11. myFlash[i].Dock = DockStyle.Fill;                 
  12. myFlash[i].EmbedMovie = true;
  13. myFlash[i].Movie = Application.StartupPath + @"\cloudstorm1.swf";   
  14.  
Aug 19 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Brian Basquille | last post by:
Hello all, What is the syntax for simply playing a WAV file in your program? Am learning VB and have two VB books but don't wanna root through them to find the code. Any help would be much...
1
by: Kiteman \(Canada\) | last post by:
Instead of a beep sound playing as an alarm or reminder I would like to be able to play a more interesting sound. On the web, I found and tried a sound routine that uses the SOUND.DRV but it does...
1
by: Peter Schmitz | last post by:
Hi, I'm just trying to play a *.wav file, making use of the unmanaged function "sndPlaySoundA" in winmm.dll, but I still got one question: How can I avoid, that the sound file itself has to be...
2
by: Dave | last post by:
Hi, I am writing a c# application that using a directshow to play file and display it on my C# gui, its work just fine but when i try to open another thread in my c# application the file stop...
7
by: Lee Moody | last post by:
I just want quick and easy way to play a .wav file out the standard sound device. It could even be as simple as activating a sound assigned to an existing windows sound event. Any suggestions?...
8
by: shlomi | last post by:
Hello, It's been long time that I'm investigating on how to play Avi file from memory, with no success. What I'm trying to do is to get a scrambled Avi file to memory, fix same data and...
3
by: Tommy DN | last post by:
I've made a program that displays the track that's playing on a (internet)radiostation. The name of the "now playing" track comes from the radiostation's website ( from the statusbar using the...
4
by: fAnSKyer/C# newbie | last post by:
I am using winmm.dll and I found that I can't just suspend it and resume it? What should I do? Any better idea? Should I use thread? and thread.suspend will work? Thanks
5
by: gazza67 | last post by:
Hi, Does anyone know how to check for when a sound has finished playing? I am currently using the SoundPlayer, there doesnt seem to be any event for this - am I missing something? Gary
3
by: Jack | last post by:
Hi, I'm writing a simple wav player (like winamp) and using the SoundPlayer class in c# 2005. Using winform buttons, I can begin playing the sound and stop half-way through the sound using:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.