Visual Studio, Flash & ActiveX pickle
About five years ago I wrote a touch screen kiosk application in Visual Studio 2005 (.net 2.0) with an embedded Flash ActiveX movie in it, which ran a Flash application written in Flash 6.
Fast forward back to the present and I've been tasked with upgrading our kiosk platform to allow for video conferencing. This requires communicating with an external application through Window Messages which handles the video call and shows the incoming video as a overlaid image.
However I've run into several (seemingly conflicting) problems getting the old Visual Studio 2005 project to run on my computer today, under Windows 7 and Visual Studio 2010.
Attempt 1: Windows 7, Visual Studio 2010, Flash 10.1 ActiveX installed
To begin with I checked the old solution out of SVN and loaded it into Visual Studio 2010, using the upgrade wizard. However when I run the project I get the following exception:System.Runtime.InteropServices.COMException was unhandled
Message=Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Source=System.Windows.Forms
ErrorCode=-2147221164
StackTrace:
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at KioskV2_Client.Form1.InitializeComponent() in C:\Users\7877.INTERNET\Desktop\KioskV2_Client_WithSkype\KioskV2_Client\Form1.Designer.cs:line 189
at KioskV2_Client.Form1..ctor() in C:\Users\7877.INTERNET\Desktop\KioskV2_Client_WithSkype\KioskV2_Client\Form1.cs:line 88
at KioskV2_Client.Program.Main() in C:\Users\7877.INTERNET\Desktop\KioskV2_Client_WithSkype\KioskV2_Client\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callbac开发者_高级运维k, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
on the following line of code in Form1.Designer.cs::
((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).EndInit();
Which sounds like Flash isn't registered as an Active X component, so I:
- Re-installed Flash 10.1
- Manually ran a regsvr32
However after doing so the problem remained
Attempt 2: Starting a new project, Windows 7, Visual Studio 2010 (target .net 2.0)
This time I created a new project in VS2010, added a reference to Flash, added it to the toolbox and dropped a reference onto the form.After hitting F5 I'm greeted with a running WinForm, with Flash happily embedded.
So my upgraded project says Flash isn't registered - however my new project runs quite happily!
Question: Why doesn't my first attempt run? I've removed Flash from the project and re-added it, but with the same failure.
In this instance, the issue was as tyranid suggested:
Just a thought, is the windows 7 box running an x64 version? If so you might have just got caught with the converted project creating a universal .NET assembly, and as there is currently no x64 version of flash it wouldn't find it. – tyranid
Starting the project fresh in 64bit and then copying over the code from the old 32bit project solved the issue.
精彩评论