Monday, August 23, 2010

Flash Control Error in VB6

There has been recent news about Adobe Flash Control causing problem in VB6 projects. The last version of flash which didnt had any problem with VB6 was Flash10e.ocx it seems all version after that are having the same problem.

Problem
When we try to save a form containing a flash control, VB6 shows an error message.
---------------------------
System Error &H80004005 (-2147467259). Unspecified error
---------------------------

If we open an old project which already have a flash control, there is no problem in saving or compiling the app as long as we dont open the form containing the flash control.

*Adding Flash Control or Adding any control to a form having a flash control
*Opening a form with flash control and/or changing property of existing control

And then trying to save it produces errors.

Solution
Downgrading to flash10e.ocx seems to fix the problem. Flash10f.ocx, Flash10g.ocx, Flash10h.ocx, Flash10i.ocx (the latest) all having the same problem. i tested all these controls.

Fortunately its not happening at runtime. And if it ever happens in the future then solution would be to use Reg-Free COM Manifest file and include the older version of Flash control with your application.

Step 1: Uninstall flash, we need to use the adobe flash uninstaller, because the flash installer leave a check in the registry and doesnt allow us to install an older version. so 1st uninstall flash using the instruction provided here

Step 2: Getting Old Version. oldapps.com has Flash10d.ocx installer, download version 10.0.42.34 from there OR Adobe provides old version of their player on this page, you need to download the fp10_archive.zip 157 MB zip file and then go to \10r45_2 folder to find flashplayer10r45_2_winax.exe which is the Flash10e setup.

fp10.1_archive.zip
\10_1r53_64 = Flash10h.ocx
\10_1r82_76 = Flash10i.ocx

fp10_archive.zip
\10r32_18 = Flash10c.ocx
\10r42_34 = Flash10d.ocx
\10r45_2 = Flash10e.ocx

Searching in Adobe forum here i found many people having the same problem. If someone see this blog post and have any solution then please suggest. Thanks!

Update: Sep 6, 2011.

These workaround dont require you to downgrade the control and will work on any flash version installed.

Workaround 1: For compiling existing application. If you have a multi-form application then you can safely compile the application If you dont open the form containing the flash control.

Workaround 2: Manual Edit method for adding flash control to new app. Add and code the flash control, then remove the control, then add a picturebox with same name as your flash control, then save and exit VB6 IDE. now open your VB Form in notepad and find the picturebox control replace the picturebox code with the code below, modify the top, left values and also other value you want to change.
ShockwaveFlashObjectsCtl.ShockwaveFlash Flash1
Height = 3615
Left = 360
TabIndex = 1
Top = 960
Width = 4815
_cx = 8493
_cy = 6376
FlashVars = ""
Movie = ""
Src = ""
WMode = "Window"
Play = "-1"
Loop = "-1"
Quality = "High"
SAlign = ""
Menu = "-1"
Base = ""
AllowScriptAccess= ""
Scale = "ShowAll"
DeviceFont = "0"
EmbedMovie = "0"
BGColor = "000000"
SWRemote = ""
MovieData = ""
SeamlessTabbing = "1"
Profile = "0"
ProfileAddress = ""
ProfilePort = "0"
AllowNetworking = "all"
AllowFullScreen = "false"
End
now move to top of the code and just below VERSION 5.00 add the following line.
Object = "{D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0"; "Flash10e.ocx"

save the file, start VB6 and compile your project (without opening the form).

21 comments:

  1. I might be wrong, but the latest 10i version doesn't seem to cause problems at the run time stage of your app, ie users can use your app on their 10i installed machines, but I have to keep 10e on my dev machine. I'm sure prev versions used to foul up at the runtime stage as well. Is this the case with other people??

    ReplyDelete
  2. Thanks a lot,it fixed my problem!

    ReplyDelete
  3. no problem at runtime, good, at least its only happening at dev time.

    ReplyDelete
  4. Gracias, me encontré con este problema hace poco tiempo, espero que la gente de adobe soluciones esto, o de lo contrario su tecnología realmente sera dejada de utilizarse por los developers.
    La solucion aqui vista es efectiva, pero esperemos que ADOBE lanze un parche para este problema.-

    ReplyDelete
  5. maraming salamat!!! God bless.. ^_^

    ReplyDelete
  6. Works great! thank you. Life saver. :)

    ReplyDelete
  7. The quickest way is to fool the system into using the Flash10e.ocx!
    Takes only 2mins to fix.
    No need to uninstall!!
    1 download the ocx http://www.afreeocx.com/ocx/info/flash10e_ocx.html
    2 find the original ocx (mine is in C:\WINDOWS\system32\Macromed\Flash)
    3 rename the original to something like Flash10hREAL.dll
    4 copy Flash10e.ocx into the folder and rename to Flash10h.ocx
    Restart computer
    PROBLEM SOLVED!

    ReplyDelete
  8. Thanks, it solved my problem.

    ReplyDelete
  9. Thanks abhishek. I was in great confusion about my VB project for un expected error. Actually my VB project has Shock Wave control over MDIform which is using fash10h.ocx. when i was opening my project, it give me Errors during load.Please Refer to Mdiform.log. so i was very shocked and search web for solution. After 10 days hard working i got solution here.
    Thank you very much once again.

    Rifaqatullah http://malikexchange.com

    ReplyDelete
  10. Thanks for the help worked great, no problems

    ReplyDelete
  11. Excelent Solution my brother, I was lost, but you save me!! :D:D Congratulations.

    André Gomes
    Pernambuco - Brazil

    ReplyDelete
  12. Your the man dude! Thanks a lot!

    ReplyDelete
  13. I used the first method. First, uninstall flash and then download and install the old version. After that, I didn't download anything else like the zip file stated above, but it worked! Thanks.

    I tried the workarounds a while ago, but I found that I have to do that all over again after modifying my form with shockwaveflash in it.

    I wonder why this only happened to me a month ago, which supposed to give errors I got before.

    ReplyDelete
  14. finally..it has been resolved! THANK YOU FOR SHARING :)

    ReplyDelete
    Replies
    1. I replaced the flash control with an OLE control, and inserted the following code

      Dim Flash1 As ShockwaveFlash

      Private Sub Command1_Click()
      OLE1.SizeMode = vbOLESizeStretch
      OLE1.AutoActivate = vbOLEActivateManual
      OLE1.CreateEmbed "", "ShockwaveFlash.ShockwaveFlash"
      OLE1.DoVerb vbOLEUIActivate
      Set Flash1 = OLE1.object
      Flash1.Movie = your movie file name
      End Sub

      Project can be saved as normal, and uses latest version of flash player

      Delete
    2. I receive a type mismatch error with the set command.

      Delete
  15. Very simply, if you need to save your project after coding, remove the flash object from the form and replace it by a Picture with the same name. If you need to edit, remove the Picture and and the flash object with the same old name (picture name), code, and so on...

    ReplyDelete

Hello

Would try to update this blog from now. many links are broken like platnet source code and many websites shutdown.