Hello,

I use a a flashcontrol in the Form application. If I have Flash installed on the computer, the control plays the movie fine.
If I uninstall the flash from the computer, I receive this error when opening the form.

I have tried to put this code inside a try{} catch(){} block to prevent this error but that did not help.

Is there any other idéa of how to prevent this error. If I take the code inside the try{} away, I dont receive the error so
it depends on this. Thanks!

Error:
HRESULT: 0x80040154(REGDB_E_CLASSNOTREG))

AxShockwaveFlashObjects::AxShockwaveFlash^ AxShockwaveFlash1 = gcnew AxShockwaveFlashObjects::AxShockwaveFlash();

String^ movieURL = "MovieURL...";

try
{
		if( String::IsNullOrEmpty(movieURL) == false )
		{ 
			panel1->Controls->Add(AxShockwaveFlash1);
			AxShockwaveFlash1->BackgroundColor = 0;		 
			AxShockwaveFlash1->Movie = movieURL;
			AxShockwaveFlash1->Base = movieURL;
			AxShockwaveFlash1->AllowFullScreen = "false";
			AxShockwaveFlash1->AllowScriptAccess = "sameDomain";
			 				 
			 
			AxShockwaveFlash1->EmbedMovie = true;
			AxShockwaveFlash1->Enabled = false;

			AxShockwaveFlash1->Size = System::Drawing::Size(425, 55);				 
			AxShockwaveFlash1->Location = System::Drawing::Point(1, 25);
			AxShockwaveFlash1->Play();
		}
}
catch(Exception^ ex){}

Um well thats the problem :P. you need flash to play it. so if you uninstalle flash it wont work. what i would suggest you do is make a setup file and then check if the user has flash.

apart from that i dont think you can get around it. you need to have flash on you comp to play it. but i could be wronge. so if someone has any better ideas please share them.

the only other way i know you could fix this is use Windows Media Player. this will then pretty much work on anyones PC. apart from mac :P. because most windos PC's already have that installed and runing.

anyway good luck with your problem

Yes I understand that the player needs flash in order to play it so my idea was to "try" to play it in a try/catch block and hopefully it would just through an exception without showing the error like it does now.

I still searching for a solution to it since it could fail like in this scenario. The idea was that the try{} would have take care of all possible scenarios but something might be missing here or any other idea ?

hmm i dont tbh. does the error pop up in a file complied version? i have a felling that in a full complied version it wont pop up. one thing you can do is make the program it self check if its is playing then make a message box show up saying this file cant play do you have flash? if not follow this link. or somthing along the lines of that.

the error your getting only seems to be a compile error. once the program is in a compiled state it shouldnt matter. it will run when there is flash and it wont run when you dont have flash. it shouldnt pop up with any errors.

but i could be wronge. just try and build your solution and run it from my computer instead of runing it straigt from the programe.

anyway best of luck

Thanks cgcgames, in a way you were right here. The error shouldn´t pop up.
Actually the error was not directly for the flashcontrol.

I was putting this line in the _Load event of the form:
panel1->Controls->Add(AxShockwaveFlash1);

The thing was that the panel1 was not constructed yet so it couldn´t be added.

So I put the code in the _Shown event of the Form:
panel1->Controls->Add(AxShockwaveFlash1);

And now I dont receive the error. However a small questionmark there was that if flash was installed it was okay to have the code in the _Load event. So a bit confusing but in a way it make sense.

Thanks

ahh ok :) nice to see you got your problem fixed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.