I have created a flash system manual which is located relative in my program path at folder named manual. When the user click play i will play the flashmanual.swf in a folder named manual relative to my program. I have coded it below but it returns error: Please help.

Shell App.Path & "\manual\student adding.swf"

Thank you for giving time.

God bless on this mother earth.

First off, in the future it would be a good idea to also post the err.number and the err.description.

Now, if your err.number is 5 and your description is Invalid proceedure call or arguement then...

The intrinsic shell function built into vb is not used to open data files. It's main purpose is to open exe's. What you need to do is checkout the ShellExecute API.

Good Luck

First off, in the future it would be a good idea to also post the err.number and the err.description.

Now, if your err.number is 5 and your description is Invalid proceedure call or arguement then...

The intrinsic shell function built into vb is not used to open data files. It's main purpose is to open exe's. What you need to do is checkout the ShellExecute API.

Good Luck

yes err.number returns 5. Im looking forward for ShellExecute API. Thank you very much. Any more idea how to use this API.?

First off, in the future it would be a good idea to also post the err.number and the err.description.

Now, if your err.number is 5 and your description is Invalid proceedure call or arguement then...

The intrinsic shell function built into vb is not used to open data files. It's main purpose is to open exe's. What you need to do is checkout the ShellExecute API.

Good Luck

I have this code but when i execute this function it doesnt load the flash. Please correct this if something is missing.

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

Public Sub RunProgram(strProgram As String)

    Dim lRet As Long

    lRet = ShellExecute(vbNull, "", strProgram, "", "", SW_SHOWNORMAL)
    
    If lRet <= 32 Then

        MsgBox "Error Running Program"

    End If

End Sub

Private Sub manualbtn_Click()

RunProgram App.Path & "\manual\student adding.swf"
End Sub

lpOperation
Address of a null-terminated string that specifies the operation to perform. The following operation strings are valid: "open" The function opens the file specified by the lpFile parameter. The file can be an executable file or a document file. It can also be a folder.
"print" The function prints the file specified by lpFile. The file should be a document file. If the file is an executable file, the function opens the file, as if "open" had been specified.
"explore" The function explores the folder specified by lpFile.

This parameter can be NULL. In that case, the function opens the file specified by lpFile.

lRet = ShellExecute(vbNull, "", strProgram, "", "", SW_SHOWNORMAL)
lRet = ShellExecute(vbNull, "open", strProgram, "", "", SW_SHOWNORMAL)

Since you are supplying a null string which is different than a null, it would be just easier to add the keyword for the function, "open".

lRet = ShellExecute(vbNull, "open", strProgram, "", "", SW_SHOWNORMAL)

Since you are supplying a null string which is different than a null, it would be just easier to add the keyword for the function, "open".

thank you for your reply.! In your correction to the code, it does not display the flashmanual.exe. But instead, ive put the path on a variable then query it on the function and it run. Thank you for your time. This problem was solved.

Dim pathmanual As String

pathmanual = App.Path & "\manual\student adding.swf"
RunProgram pathmanual
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.