locked
a question guys RRS feed

  • Question

  •  

    how to play the swf

    i tried adding the reference in the project menu

    but it produce the error

    tell me how to play it

    if have any ocx control to play it tell me pls

    Sunday, September 23, 2007 12:08 PM

Answers

  • Hi Jin,

     

    To play flash on a Form in Visual Studio, you need to install the latest version of Adobe Macromedia Flash Player (9.0 r28). The component will be located at "%systemroot%\system32\macromed\flash9c.ocx". Then you'd better register manually it like this:

    Regsvr32 flash9c.ocx

     

    And then please follow these steps to add Shockwave Flash Object correctly on your form in VB 2005 Express:

    1. In Solution Explore, right-click References and choose Add Reference.

       In COM tab, add Shockwave Flash (e.g. Flash9c.ocx)

     

    2. Right-click Toolbox -> Click "Choose Items", in COM tab, choose Shockwave Flash Object, then you can see the control in the Toolbox.

     

    3. Drag and drop the Shockwave control on the form, you may get the error message "Failed to import the ActiveX control. Please ensure it is properly registered", ignore it and click OK.

     

    4. Right-click the project in Solution Explorer, choose "Rebuild". When the project rebuild succesfully, you are able to add the Shockwave control on the form this time.

     

    5. Specify .swf file for the Movie property of Shockwave control.

     

    Please check the two threads for detail.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2079409&SiteID=1

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2092491&SiteID=1

     

    Regards,

    Martin

    Tuesday, September 25, 2007 6:41 AM
  • To play flash file (.swf) on WinForm, here is a better approach: Use the AxWebBrowser component.

     

    Right-click the ToolBox -> select 'Choose Items ...' -> Select the COM tab -> Select "Microsoft Web Browser"

     

    There should now be a Microsoft Web Browser control in the toolbox, drag it onto your form and specify .swf file.

     

        Me.AxWebBrowser2.Navigate("E:\VBproject\topic.swf")

     

     

     Please check this thread for detail.

     

    Thanks,

    Martin

    Wednesday, September 26, 2007 10:29 AM
  •  jin katama wrote:

    my question is how to get no of files,filename,location in a drive

     

    Hi Jin,

     

    The following code shows how to read all files and subfolders (in drive D:\) into ArrayList objects and show full file path.

    Code Block

    Imports System.IO

    Imports System.Collections

    Imports System.Collections.Generic

     

    Public Class Form1

     

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

     

            Dim arrFiles As ArrayList = New ArrayList()

            Dim arrDirs As ArrayList = New ArrayList()

            Dim dirpath As String = "D:\"

     

            'Retrieve all files in the directory

            Dim strFiles() As String = Directory.GetFiles(dirpath)

     

            'Retrieve all sub directories in the directory

            Dim strDirs() As String = Directory.GetDirectories(dirpath)

     

            'Add all files to the ArrayList

            For Each name As String In strFiles

                arrFiles.Add(name)

                MessageBox.Show(name) 'It will show the file with full file path.

            Next

     

            'Add all files to the ArrayList

            For Each name As String In strDirs

                arrDirs.Add(name)

                MessageBox.Show(name) 'It will show the subfolder with full folder path.

            Next

     

        End Sub

     

    End Class

     

    Since it is not related to the title of the original post, next time, please start a new thread with a different title so that more people can see that you are having this issue and help you.


     

    Thanks,

    Martin

    Thursday, September 27, 2007 6:20 AM
  • The following code is what you want. Please take a try.

     

    Code Block

    Imports System.IO

    Imports System.Collections

    Imports System.Collections.Generic

     

    Public Class Form1

     

        Dim arrFiles As ArrayList = New ArrayList()

        Dim arrDirs As ArrayList = New ArrayList()

     

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            GetFile("D:\New Folder"'Call Recursive function

        End Sub

     

     

         'Recursive function

        Private Sub GetFile(ByVal dirPath As String

     

            'Retrieve all files in the directory

            Dim strFiles() As String = Directory.GetFiles(dirPath)

     

            'Add all files to the ArrayList

            For Each name As String In strFiles

                arrFiles.Add(name)

                MessageBox.Show(name)

            Next

     

            'Retrieve all sub directories in the directory

            Dim strDirs() As String = Directory.GetDirectories(dirPath)

     

            'Determine if the folder has subfolders.

            If strDirs.Length = 0 Then

                MessageBox.Show(dirPath + "  has no subfolder!")

            Else

     

                'Add all subFolders to another ArrayList

                For Each name As String In strDirs

                    arrDirs.Add(name)

                    MessageBox.Show(name)

                    GetFile(name)    'Call Recursive function

                Next

     

            End If

     

        End Sub

     

    End Class

     

     

    Monday, October 1, 2007 4:29 AM

All replies

  • Not everyone here is a guy.

     

    What error?  What do you mean by SWF?

    Sunday, September 23, 2007 12:21 PM
  • SWF = I think it's flash
    Sunday, September 23, 2007 12:31 PM
  •  

    you're right.

     

    I knew I recognized that from somewhere.

    Sunday, September 23, 2007 12:33 PM
  • Hi Jin,

     

    To play flash on a Form in Visual Studio, you need to install the latest version of Adobe Macromedia Flash Player (9.0 r28). The component will be located at "%systemroot%\system32\macromed\flash9c.ocx". Then you'd better register manually it like this:

    Regsvr32 flash9c.ocx

     

    And then please follow these steps to add Shockwave Flash Object correctly on your form in VB 2005 Express:

    1. In Solution Explore, right-click References and choose Add Reference.

       In COM tab, add Shockwave Flash (e.g. Flash9c.ocx)

     

    2. Right-click Toolbox -> Click "Choose Items", in COM tab, choose Shockwave Flash Object, then you can see the control in the Toolbox.

     

    3. Drag and drop the Shockwave control on the form, you may get the error message "Failed to import the ActiveX control. Please ensure it is properly registered", ignore it and click OK.

     

    4. Right-click the project in Solution Explorer, choose "Rebuild". When the project rebuild succesfully, you are able to add the Shockwave control on the form this time.

     

    5. Specify .swf file for the Movie property of Shockwave control.

     

    Please check the two threads for detail.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2079409&SiteID=1

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2092491&SiteID=1

     

    Regards,

    Martin

    Tuesday, September 25, 2007 6:41 AM
  • To play flash file (.swf) on WinForm, here is a better approach: Use the AxWebBrowser component.

     

    Right-click the ToolBox -> select 'Choose Items ...' -> Select the COM tab -> Select "Microsoft Web Browser"

     

    There should now be a Microsoft Web Browser control in the toolbox, drag it onto your form and specify .swf file.

     

        Me.AxWebBrowser2.Navigate("E:\VBproject\topic.swf")

     

     

     Please check this thread for detail.

     

    Thanks,

    Martin

    Wednesday, September 26, 2007 10:29 AM
  •  

    i have a different question

    pls help me to do this

     

    my question is how to get no of files,filename,location in a drive

     

    for eg:

    i an anti-virus tool it search for the virus in a drive during that time the filename with its location is displayed in the screen

    like this how to get this thing friends

    Wednesday, September 26, 2007 2:06 PM
  •  jin katama wrote:

    my question is how to get no of files,filename,location in a drive

     

    Hi Jin,

     

    The following code shows how to read all files and subfolders (in drive D:\) into ArrayList objects and show full file path.

    Code Block

    Imports System.IO

    Imports System.Collections

    Imports System.Collections.Generic

     

    Public Class Form1

     

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

     

            Dim arrFiles As ArrayList = New ArrayList()

            Dim arrDirs As ArrayList = New ArrayList()

            Dim dirpath As String = "D:\"

     

            'Retrieve all files in the directory

            Dim strFiles() As String = Directory.GetFiles(dirpath)

     

            'Retrieve all sub directories in the directory

            Dim strDirs() As String = Directory.GetDirectories(dirpath)

     

            'Add all files to the ArrayList

            For Each name As String In strFiles

                arrFiles.Add(name)

                MessageBox.Show(name) 'It will show the file with full file path.

            Next

     

            'Add all files to the ArrayList

            For Each name As String In strDirs

                arrDirs.Add(name)

                MessageBox.Show(name) 'It will show the subfolder with full folder path.

            Next

     

        End Sub

     

    End Class

     

    Since it is not related to the title of the original post, next time, please start a new thread with a different title so that more people can see that you are having this issue and help you.


     

    Thanks,

    Martin

    Thursday, September 27, 2007 6:20 AM
  • thank u a lot

    Thursday, September 27, 2007 4:24 PM
  • hello Martin Xie - MSFT and friends

     

    i have created a algorithm which like this

     

    home:

    getfiles

    getfolders

    if sub folders exits then

    goto home

    else

    getfiles of folders

    endif

     

    you have already give the coding to get the file with full path

     

    like that how do the program get the subfolders files

     

    i tell u in clear

     

    assume

     

    in drive d you having a file a folder and a folder which is inside the first folder

     

    i know that i can get the files in the folder but how do i know there is a sub-folder inside the folder

     

    after this question a had a idea that recursive function call like in the above algorithm check-for-subfolder

     

    but how do the program identifies whether the folder has sub-folder or not and how do i get the files from the

     

    sub folder

     

    if a folder has continous sub folder upto four or six levels or unknown the loop for the check-sub-folder goes on

     

    running

     

    simply

     

    how to get total no of files in the drive which includes the files in the folder and sub-folder......

     

    pls help

     

    or else my mind will burst on burn it carbon pieces

     

     

    Friday, September 28, 2007 4:09 PM
  • Sunday, September 30, 2007 11:01 AM
  • The following code is what you want. Please take a try.

     

    Code Block

    Imports System.IO

    Imports System.Collections

    Imports System.Collections.Generic

     

    Public Class Form1

     

        Dim arrFiles As ArrayList = New ArrayList()

        Dim arrDirs As ArrayList = New ArrayList()

     

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            GetFile("D:\New Folder"'Call Recursive function

        End Sub

     

     

         'Recursive function

        Private Sub GetFile(ByVal dirPath As String

     

            'Retrieve all files in the directory

            Dim strFiles() As String = Directory.GetFiles(dirPath)

     

            'Add all files to the ArrayList

            For Each name As String In strFiles

                arrFiles.Add(name)

                MessageBox.Show(name)

            Next

     

            'Retrieve all sub directories in the directory

            Dim strDirs() As String = Directory.GetDirectories(dirPath)

     

            'Determine if the folder has subfolders.

            If strDirs.Length = 0 Then

                MessageBox.Show(dirPath + "  has no subfolder!")

            Else

     

                'Add all subFolders to another ArrayList

                For Each name As String In strDirs

                    arrDirs.Add(name)

                    MessageBox.Show(name)

                    GetFile(name)    'Call Recursive function

                Next

     

            End If

     

        End Sub

     

    End Class

     

     

    Monday, October 1, 2007 4:29 AM
  •  

    thank u a lot

     

     

    Tuesday, October 2, 2007 8:39 AM
  • Hello,

     

    Considering that many developers in this forum ask how to manipulate WebBrowser component (enabling flash, suppressing error messages, proxy support), rotate or flip images, my team has created a code sample for this frequently asked programming task in Microsoft All-In-One Code Framework. You can download the code samples at:

     

    VBWebBrowserWithProxy

     

    http://bit.ly/VBWebBrowserWithProxy

     

    CSWebBrowserWithProxy

     

    http://bit.ly/CSWebBrowserWithProxy

     

    With these code samples, we hope to reduce developers’ efforts in solving the frequently asked

    programming tasks. If you have any feedback or suggestions for the code samples, please email us: onecode@microsoft.com.

    ------------

    The Microsoft All-In-One Code Framework (http://1code.codeplex.com) is a free, centralized code sample library driven by developers' needs. Our goal is to provide typical code samples for all Microsoft development technologies, and reduce developers' efforts in solving typical programming tasks.

    Our team listens to developers’ pains in MSDN forums, social media and various developer communities. We write code samples based on developers’ frequently asked programming tasks, and allow developers to download them with a short code sample publishing cycle. Additionally, our team offers a free code sample request service. This service is a proactive way for our developer community to obtain code samples for certain programming tasks directly from Microsoft.

    Thanks

    Microsoft All-In-One Code Framework

    Friday, March 25, 2011 1:41 AM