-
can someone shed some light on this
Right what it is I have been tryin to run an swf file from a command button. I had no luck with this so made it an exe file but although it loads now It is an mp3 player that runs off an xml doc. It will not play anything when ran from my command button. If it is run itself it plays no problem.
heres the code Im using.
Private Sub Command6_Click()
Shell "C:\dir\app.exe", 1
End Sub
Hope someone can help because this is just the only thing stoppin my project bieng complete.
thanks in advance
R
-
Re: can someone shed some light on this
Just open it in IE, as long as it has Flash installed. I tried to open a swf file, and could't unless I was using IE or FireFox. That's what I would do.
-
Re: can someone shed some light on this
not sure how to do that and will it open in a large window?
or can I set the size to the size of the app
thanks
Rob
-
Re: can someone shed some light on this
another thing is that its almost as if it will not see the xml file when opened from vb
cheers
R
-
Re: can someone shed some light on this
I have been reading around a bit am I right in thinking that I need to add a webbrowser to a form and then point it to th html file that flash generates.
hope I am right lol
thanks
R
-
Re: can someone shed some light on this
IE wil open a VALID XML file. That's why I wanted you to pay attention to the format.
As for the FLASH file:
You can open it on it's own, or you can open IE in a window on your form.
First, you should make sure that you can call the file, and open IE. Next, worry about opening it in your form. This is the shell execute command that will open the default program. First try just the swf file to see if it is associated with IE. Next supply the path of IE, and add the flash file as a parameter. If this works, then you can put it in your form.
Replace thie:
"mailto:[email protected]?subject=something&body=this is the body"
with this:
"\flashpath\myflash.swf"
"\addyourpath\iexplore.exe \flashpath\myflash.swf"
VB Code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_HIDE As Long = 0
Private Const SW_SHOWNORMAL As Long = 1
Private Sub Command1_Click()
ShellExecute 0&, "OPEN", "mailto:
[email protected]?subject=something&body=this is the body", vbNullString, "C:\", SW_SHOWNORMAL
' c:\ = Destination Folder
End Sub
Hope it works out for you. :wave:
-
Re: can someone shed some light on this
sorry, I'm not sure how you mean put the path in for IE, I put this and it opens but again it wont play anything.
VB Code:
Private Sub Command6_Click()
ShellExecute 0&, "OPEN", "c:\mgamerz\test.swf", vbNullString, "C:\", SW_SHOWNORMAL
' c:\ = Destination Folder
End Sub
sorry to keep bothering you with this
thanks for replying
R
-
Re: can someone shed some light on this
what I meant about the IE path - will it not change on different machines.
R
-
Re: can someone shed some light on this
yes, but deal with that as it comes. first see if it wil open with IE programmatically. in my system its windows\servicepackfiles\i386 for example
first open it with ie, then open it without ie, then open it in your program, or you won't know what isn't working.
-
Re: can someone shed some light on this
I can open IE but not the swf in it but I think Ive done something wrong
VB Code:
Private Sub Command6_Click()
ShellExecute 0&, "OPEN", "c:\program files\internet explorer\iexplore.exe \c:\mgamerz\test.swf", vbNullString, "C:\", SW_SHOWNORMAL
' c:\ = Destination Folder
End Sub
thnks
R
-
Re: can someone shed some light on this
You have an extra slash
\c:\mgamerz
should be
c:\mgamerz
if that works, just try the flash
(I'll help more tomorrow)
-
Re: can someone shed some light on this
I currently have this code on my button and whe its clicked absolutely nothing happens.
VB Code:
Private Sub Command6_Click()
ShellExecute 0&, "OPEN", "c:\program files\internet explorer\iexplore.exe c:\mgamerz\test.swf", vbNullString, "C:\", SW_SHOWNORMAL
' c:\ = Destination Folder
End Sub
I was in the college library and must have looked at every vb book and none of them mentioned flash or swf. This is drivin me nuts!!
R
-
Re: can someone shed some light on this
hmmm. I just tried all 3 ways, and i can open ie, but trying to open a swf file produces a 404 not found error. I don't know how to open it. I have a file called splash.swf that won't open.
I'll look around for something.
-
Re: can someone shed some light on this
-
Re: can someone shed some light on this
I read that Windows Media Player opens them if you have version 6.0 or greater.
I ran into a secrutiy issue when I tried to open with the swf. If you can get around that, you may be able to run the flash in media player.
I thought the flash.ocx would play it.
-
Re: can someone shed some light on this
So I could use media player to open an swf movie?
-
Re: can someone shed some light on this
i tried. security settings prevented it. click on the flash and select open with.
both shockwave and wmp have sdk's that you can download. they might shed light on what you are trying to do.
-
Re: can someone shed some light on this
There is a standalone flash viewer available which *might* solve your problem but there might also be another approach...
Use the createobject("internetexplorer.application") method and then .navigate to the file...I havn't actually tried it (been meaning to get around to that as I've had some problems reliably opening localhost files in IE myself) but I'm pretty sure it will work - I've done it with VBScript previously for parsing links, etc, out of pages...
-
Re: can someone shed some light on this
Use the "shockwave flash" control on your form. Its in components :)
-
Re: can someone shed some light on this
I can get the flash ito vb but the swf reads an XML file but it aint seeing the file.
-
Re: can someone shed some light on this
Strange
Ensure your paths are correct for the xml file. You cant fix them in flash because you are obviously installing to different folders.
I know you can do it because we do it here but I cant use Flash so I cant help on that bit sorry :)
-
Re: can someone shed some light on this
The path to the xml must be correct because the player reads the xml and plays when just run on its own. but if I try to run it from a command button - nothing
-
Re: can someone shed some light on this
Check you have the correct flash version in the ocx. Run the program and right click the flash window to show the version. Then check its the same. because VB uses an ocx it isnt necessarily the one used by IE :)
-
Re: can someone shed some light on this (sort of workin)
Hi all,
Right this is really strange I have my swf loading from my command button that reads from an xml file. This works fine until I add a file to be added to the xml. After doing this it will do nothing until I close it and run again.
Any ideas
thanks
R
-
Re: can someone shed some light on this
Post some code, and we'll take a look.
-
Re: can someone shed some light on this
Thanks for reply,
I actually got it workin in the end with this simple code.
Private Sub Command6_Click()
Shell "C:\player\playa.exe", 1
End Sub
now I think I tried this before but because it wasnt playing didnt think it was working. I will only play anything if I close the program then restart it. I was wondering if theres someway of doing like a refresh. I am probably totally wrong lol - It was just a though.
Thanks
R
-
Re: can someone shed some light on this
can you stop the player? otherwise, maybe you could terminate the exe and then initialize it again?
-
Re: can someone shed some light on this
I the controls on the player stop and start it etc and to terminate it I just close it from the top right corner
-
Re: can someone shed some light on this
Sorry I forgot to mention this, I want to be able to close the player add another track/s and the update and launch the player again but to do this I have to close the whole program and restart it.
-
Re: can someone shed some light on this
would it need a pause maybe somewhere?
-
1 Attachment(s)
Re: can someone shed some light on this
Use an API to kill it by name.
-
Re: can someone shed some light on this
will I need to add that to my existing project somwhere?
-
Re: can someone shed some light on this
Just add Terminate.bas (a module) to your app, and then include the line from the form load into your program when you want to teminate it.
-
Re: can someone shed some light on this
I want it to end when I close the swf so will i need to put the swf on a form?
-
Re: can someone shed some light on this
Put the flash in a form, and execute it when you close the form. That seems like a good way to me. You might be able to use an API if the process ends, but I'm thinking it doesn't end. If it were the MM control, you could send it a STOP command. I'm not sure. Why don't you get the Flash SDK ?
-
Re: can someone shed some light on this
whats the best way do you think add the flash to a separate form and then load it from my main form with a button?
-
Re: can someone shed some light on this
Use the vb reference to Macromedia Flash. I saw a post on it a few days ago.
-
Re: can someone shed some light on this
Still no joy with this I can get the flash into a form but as soon as its running nothing happens again as if it aint seeing the XML file.
-
Re: can someone shed some light on this
-
Re: can someone shed some light on this
One thing that may work but I'm not sure how to di is to add a shorcut on the desktop to the player. I can get a shortcut to my app on the desktop but I think it would work if I could add another shortcut to the swf file. Any ideas I'll post my code in a min.
thanks
R
-
Re: can someone shed some light on this
-
Re: can someone shed some light on this
would I be able to put a button that will refresh everything because it is working best when I just load load the swf from the main form but after adding I need to start the whole app again.
thanks
R
-
Re: can someone shed some light on this
Have you checked the flash version number? Ensure you have the most upto date the control can be different from that in IE for some reason. I have seen it a few times and it stops certain things occuring like text or buttons appearing etc :)
-
Re: can someone shed some light on this
How do you mean check the flash version? In VB? hows that done an where can I get the update if needed.
Thanks
R
-
Re: can someone shed some light on this
Load a control onto a form and load in a flash file. Run it and right click to see the version number. What is it? :)
-
Re: can someone shed some light on this
It says macromedia flash player version 7
-
Re: can someone shed some light on this
7 . 0 . 19 is the new one that came with Firefox. I don't think it updated IE (at least one of them didn't, it would only update Netscape and Firefox and Mozilla)
It probably was Flash.
Do you mean that your app won't read the xml unless you restart your app, or that flash won't read a swf unless you restart aplayer? In the second case, just use TerminateExe to kill aplayer.exe and you'll be good to go.
-
Re: can someone shed some light on this
Sorry if I wasn't clear the player shows and loads from the button but it wont read the XML file until the app is restarted.
Thanks
R
-
Re: can someone shed some light on this
Can you read the xml file first?
-
Re: can someone shed some light on this
Yes it will read the xml and play everything but when I add a track and update the XML it will not play anything.
Thanks
R
-
Re: can someone shed some light on this
are you using FreeFile or a static file number? Did you try to terminate the exe and then read the xml file? Did you ever post your code?
-
Re: can someone shed some light on this
I dont understand what you mean about Freefile or static file I tried adding the code to terminate the exe but I couldnt get it to do anything the only code I can manage to get it to do anything remotely like running the file is using this simple code
Private Sub Command6_Click()
Shell "C:\player\playa.exe", 1
End Sub
I have tried adding the swf to a form but then it wont even read the XML at all.
Thanks
R
-
Re: can someone shed some light on this
what does the swf have to do with the xml file? i thought that you were making an mp3 player. You read playlists from an xml file, and you want to show a swf spashscreen.
is that close, or am i thinking of something else?
-
Re: can someone shed some light on this
Not sure if this result is relavent any more, however, if you want to use
ShellEx to open IE and pass the file (.swf) as a param, like:
VB Code:
ShellExecute 0&, "OPEN", "iexplore.exe", "C:\mgamerz\test.swf", "C:\", SW_SHOWNORMAL
Or using Shell:
VB Code:
Shell ("c:\program files\internet explorer\iexplore.exe C:\mgamerz\test.swf")
Bruce.
-
Re: can someone shed some light on this
The swf is the actual mp3 player.This mp3 player runs off the xml file. It displays the information of the song and has a series of buttons that play, pause, next track etc
R
-
Re: can someone shed some light on this
I got you. Can you read the xml file in again to reset things?
-
Re: can someone shed some light on this
no it wont do anything until I close the app and restart
-
Re: can someone shed some light on this