-
1 Attachment(s)
VB6.0 - Basic Flash Player
Hi,
Here is a basic flash player I made in VB6.0 you can download the source code below.
Below is the current code!
Code:
'By Aaron "Nightwalker83" Spehr
Dim n As Integer
Private Sub File1_Click()
File1.Drag
End Sub
Private Sub Form_Load()
'Set the background colour, etc
Me.BackColor = &H80000008
Me.BorderStyle = Sizable
File1.Pattern = "*.swf"
File1.DragMode = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Close the program
Unload Me
End
End Sub
Private Sub ShockwaveFlash1_DragDrop(Source As Control, X As Single, Y As Single)
'This loads the movie
Call ShockwaveFlash1.LoadMovie(0, File1.Path + "\" + File1.FileName)
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo err:
Dir1.Path = Drive1.Drive
Exit Sub
err:
MsgBox ("Please choose another drive!")
End Sub
I can't get the keyboard to interact with the flash control. However, I have noticed that if the screen is big enough you can use the control inside the flash movie to start, stop, etc.
Check link below for any problems relating to getting the project to work correctly.
Nightwalker
Edit:
Just a word of warning though, use the above code with flash 10e or earlier, the other versions of flash 10 seem to have problems which, can be talked about in this thread.
-
Re: VB6.0 - Basic Flash Player
I have created the code below to re-size the player and also player online shockwave flash files.
vb Code:
Private Sub Command1_Click()
'15/01/2011
' Play a streaming video
' The base url
ShockwaveFlash1.Base = "http://www.mysite.com/Nights%20Hell%20Hole/"
'URL leading the actual movie file
ShockwaveFlash1.Movie = "http://www.mysite.com/Nights%20Hell%20Hole/media/media.swf"
Call ShockwaveFlash1.Play
End Sub
Private Sub Form_Resize()
'15/01/2011
'Resize the the shockwave flash player
ShockwaveFlash1.Height = Me.Height
ShockwaveFlash1.Width = Me.Width
End Sub
-
Re: VB6.0 - Basic Flash Player
This code allows you to move the animation to the frame specified:
vb Code:
'Replace "2" with the frame number you want the animation to jump to.
Private Sub cmdGoto_Click()
Call ShockwaveFlash1.GotoFrame(2)
End Sub
-
Re: VB6.0 - Basic Flash Player
The source you give for that flash.ocx is violating Adobe's licensing terms.
Basically in order to use Flash as a user, you must download and run the full installer package. To redistribute Flash you must apply for a license to do so, and then you still must give the user the whole install package and they must run it and go through the setup user interface.
Silent installs of all or part of Flash violates the licensing terms.
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
dilettante
The source you give for that flash.ocx is violating
Adobe's licensing terms.
Basically in order to use Flash as a user, you must download and run the full installer package. To redistribute Flash you must apply for a license to do so, and then you still must give the user the whole install package and they must run it and go through the setup user interface.
Silent installs of all or part of Flash violates the licensing terms.
...and that's why flash fails. :p
-
Re: VB6.0 - Basic Flash Player
very nice walker nice!!!!!!!!!!!!!!!!!!
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
DavesChillaxin
...and that's why flash fails. :p
The main reasons are that (a.) Adobe doesn't want users complaining that Flash got installed "by stealth" onto a system, (b.) that they get credit for it, and most importantly (c.) that the mechanism to provide security patches and other updates gets put into place on users' machines.
The free license is to make sure that developers are aware of and conform to these requirements - or face litigation. :p
-
Re: VB6.0 - Basic Flash Player
Sorry this is an old thread.
Nightwalker's app works ok but the Form isn't sized correctly to see all controls. If you resize the Form and save the project it brings up a System Error &H8000-4005(-2147467259).
Quote:
System Error 'item'
Visual Basic encountered an error that was generated by the system or an external component and no other useful information was returned.
The specified error number is returned by the system or external component (usually from an Application Interface call) and is displayed in hexadecimal and decimal format.
Now I've used the flashplayer control for years. If I save my something on my first app it saves no problem. If I do the same on an old app I made the exe runs no problem. When I load the app it shows an error log.
Quote:
Line 41: Cannot load control mnuFile; containing control not a valid container.
Line 41: The file C:\Projects\VW Technical\Main.frm could not be loaded.
When the app worked perfectly when I made it and compiled the exe last year. If I add a new flashplayer to a new Form and save it, shows the same error.
Now Flash Player 14.0.0.136 Beta (IE) are updating all the time I wonder if this is causing the error?
What are you guys thoughts if you resize Nightwalker's Form and save it.
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
Keithuk
Sorry this is an old thread.
Nightwalker's app works ok but the Form isn't sized correctly to see all controls. If you resize the Form and save the project it brings up a System Error &H8000-4005(-2147467259).
Well, I have not looked at this project for a while so can not remember the form layout. The only thing I remember is Flash version 11.0? And up crashes a lot and I do not know why?
-
Re: VB6.0 - Basic Flash Player
Thanks for the reply Nightwalker83
If you start a new project and add the Shockwave control and just add that control to a Form and save it without any code you get the same error which is very disappointing.
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
Keithuk
Thanks for the reply Nightwalker83
If you start a new project and add the Shockwave control and just add that control to a Form and save it without any code you get the same error which is very disappointing.
I think that error is also the result of that particular version of Flash, try those of the earlier version and see if the problem still occurs. Versions 10e and earlier are the versions that seem to work ok. See the first post for details.
-
Re: VB6.0 - Basic Flash Player
If you look at Project1.vbp is says Object={D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0; Flash10d.ocx
As I've said they update the flash player weekly which is becoming a bit of a pain. I may have an old flash7.ocx or flash9.ocx somewhere.
There are older version on http://www.oldversion.com/windows/ma...-flash-player/
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
Keithuk
As I've said they update the flash player weekly which is becoming a bit of a pain.
Yes, and the newer versions don't seem to work the example I created above version "10e" was the last version of flash I was able to get to work with the example project. I also, see that the user receives a system error: &H80004005 (-2147467259) which, is related to the Flash.ocx, I can't remember if the error occurred with other versions?
Edit:
Quote:
Originally Posted by
Keithuk
Nightwalker's app works ok but the Form isn't sized correctly to see all controls.
Just remove or change this code in the Form_Resize event
Code:
ShockwaveFlash1.Height = Me.Height
ShockwaveFlash1.Width = Me.Width
-
Re: VB6.0 - Basic Flash Player
I registered an old Flash7.ocx in C:\Windows\System32\Macromed\Flash and added it in Components and added it to a Form. It said its not a registered activeX even though ActiveX Manager says its registered.
I registered an old Flash9.ocx in C:\Windows\System32\Macromed\Flash and added it in Components and added it to a Form. It showed the same error when I tried to save it.
Every time you check Components it shows the Flash32_14_0_0_155.ocx. I unregistered Flash32_14_0_0_155.ocx but the same thing happens.
This has become a pain in the backside.
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
Keithuk
This has become a pain in the backside.
Which Operating System are you using?
Edit:
The only error I receive is if I try to save the project with the ShockWaveFlash control still being used by the project. To be able to save the project delete the control from the form then uncheck the control in the "Components" list, click "Apply", close the window then save the project as you normally do.
-
Re: VB6.0 - Basic Flash Player
Windows XP SP3 and Windows 7 SP1 32bit I get the same error on both. Yet when I made this new app in December 2013 it worked perfectly and compiled and the compiled exe still works without any errors.
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
Keithuk
Windows XP SP3 and Windows 7 SP1 32bit I get the same error on both. Yet when I made this new app in December 2013 it worked perfectly and compiled and the compiled exe still works without any errors.
Are you using the app you created last December? The problem seems to be with ShockWaveFlash itself rather than Visual Basic 6.0 or the above code.
-
Re: VB6.0 - Basic Flash Player
Yes the original app runs ok I just wanted to tidy it up and finish it off. As I've said Adobe update the flash player weekly this didn't matter with the old Flash7.ocx, Flash8.ocx and Flash9.ocx. When I made an app using Flash9.ocx and took it to work where they were on Flash10.ocx or Flash11.ocx it still worked perfectly.
I have another app that uses a flash movie which was made a few years ago and that opens runs and compiles and the vbp files says:
Object={D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0; Flash32_14_0_0_136.ocx so that's using the newer version.
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
Keithuk
I have another app that uses a flash movie which was made a few years ago and that opens runs and compiles and the vbp files says:
Object={D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0; Flash32_14_0_0_136.ocx so that's using the newer version.
Since the problem is Flash itself I can not help.
-
Re: VB6.0 - Basic Flash Player
Yes it seems like a flash error rather than VB.
If you guys just start a new project and add the flash player component then add that to a Form an just click save it will show that System Error &H8000-4005(-2147467259) error without any code added. I really need to get this app finished and Google doesn't show any solutions.
-
Re: VB6.0 - Basic Flash Player
Maybe you can a freeware component that act in the same basic way to flash, without the error?
-
Re: VB6.0 - Basic Flash Player
Maybe but that means adding another ocx or dll to the app.
Remember I said I made an app years ago that uses the flash player post #18 and I could change and code and save it and I compiled it on 03/07/2014.
I've just opened that app again on Win7 and it would load frmMain with an error.
Line 30: Cannot load control mnuFile; containing control not a valid container.
Line 30: The file C:\Projects\Batteries\Main.frm could not be loaded.
There is nothing in mnuFile only mnuPrint to print diagrams and text via CommonDialog and Exit.
I've just opened the same app on WinXP no problem just added a few spaces in and saved and recompiled the app no problem.
I updated the Flash Player 14.0.0.155 Beta (IE).exe on both computers this week, again its a pain in the backside.
I really think I should make a new thread in VB6 not CodeBank as more users may see it.
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
Keithuk
Maybe but that means adding another ocx or dll to the app.
Well, given the fact that you were able to run and save the project correctly without seeing the message mentioned in post #13 and that you are now experiencing non-flash related problems with the project I think it some how became corrupt.
-
Re: VB6.0 - Basic Flash Player
In post #13 you only mention resizing.
I make backups of every app I make and even the backup won't load in VB again, I still say is a Flash Player ocx problem.
-
Re: VB6.0 - Basic Flash Player
Quote:
Originally Posted by
Keithuk
In post #13 you only mention resizing.
I make backups of every app I make and even the backup won't load in VB again, I still say is a Flash Player ocx problem.
Yes, it is a Flash ocx problem as I have previously stated and in the first part of post #13 I said
Quote:
Originally Posted by Post #13
Yes, and the newer versions don't seem to work the example I created above version "10e" was the last version of flash I was able to get to work with the example project. I also, see that the user receives a system error: &H80004005 (-2147467259) which, is related to the Flash.ocx, I can't remember if the error occurred with other versions?
-
Re: VB6.0 - Basic Flash Player
I opened my old project yesterday and as normal it can't load frmMain because of the stupid error.
Quote:
Line 41: Cannot load control mnuFile; containing control not a valid container.
Line 41: The file C:\Projects\VW Technical\Main.frm could not be loaded.
As I've said there is nothing in the menu's only File/Exit and Help/About. I did have Pause/Play in the original app but this didn't work properly so I've left it of the new Form.
Code:
Private Sub mnuPlay_Click()
Select Case mnuPlay.Caption
Case "&Play"
ShockwaveFlash1.Playing = True
mnuPlay.Caption = "&Pause"
Case "&Pause"
ShockwaveFlash1.Playing = False
mnuPlay.Caption = "&Play"
End Select
End Sub
I added a new Form and I had the old project zipped so I browsed the frmMain code and copied it into a txt file. I added all code and saved the project, the flash player control was still on the toolbox. I than added the flash player control to the Form and saved the project again. It saved no problem. Previously when I've added the flash player control with no code and tried to save it showed the error.
I closed the project and it reopened without any errors even though the menu code was exactly the same, stupid VB.
Flash Control Error in VB6
-
Re: VB6.0 - Basic Flash Player
Yes, I have seen that site, in fact I posted that same link in the thread I linked to in the first post! That is where I found the information referring to Flash version "10e".
-
Re: VB6.0 - Basic Flash Player
Ok I've used Microsoft Internet Control ieframe.dll as suggested to show the swf movie's and it now works ok.
I did have a slight bug when extracting the swf files from a resource file. I never use the ID number I always give it a name.
Code:
Dim sBuffer As String
Dim FileNum As Integer
FileNum = FreeFile()
sBuffer = StrConv(LoadResData("101", "SWF"), vbUnicode)
Open App.Path & "\Temp.swf" For Output As #FileNum
Print #FileNum, sBuffer
Close #FileNum
WebBrowser1.Navigate2 App.Path & "\Temp.swf"
It was showing a 326 runtime error can't find 101 resource identifier, I removed the "" then it was ok.