Results 1 to 13 of 13

Thread: problem with DirectX in a project when published

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    14

    problem with DirectX in a project when published

    hello everybody,
    i made a project in visual basic 2005 with sounds using DirectX
    for example :
    filepath = My.Application.Info.DirectoryPath
    filepath = filepath.Substring(0, filepath.Length - 9)
    Dim MySound1 As New Microsoft.DirectX.AudioVideoPlayback.Audio(filepath & "sounds\Am.wav")
    MySound1.Play()

    the project seems to work fine but when i tried to publish it the sounds don't play and there is an error like this :
    Error in the application.
    -2147220970 (VFW_E_NOT_FOUND)
    at Microsoft.DirectX.AudioVideoPlayback.Audio.Open(String fileName, Boolean autoRun)
    at Microsoft.DirectX.AudioVideoPlayback.Audio..ctor(String fileName)
    at guitarlessons.Form1.Button4_Click(Object sender, EventArgs e)
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    And of course some other errors just like this one
    What should i do?...please help me this assay is my final thesis ...
    sorry for my english
    theodora

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: problem with DirectX in a project when published

    It looks like either your sound file hasn't been deployed with your application or else it has been deployed to a different location. You should first go into the Publish properties of project and make sure that the sound file is being included.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: problem with DirectX in a project when published

    Is the filepath = filepath.Substring(0, filepath.Length - 9) line of code to get rid of the bin\debug folder? If so, that is probably your problem.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: problem with DirectX in a project when published

    Quote Originally Posted by Negative0 View Post
    Is the filepath = filepath.Substring(0, filepath.Length - 9) line of code to get rid of the bin\debug folder? If so, that is probably your problem.
    Well spotted. I should look more carefully.

    My point and this are related. It seems that you're pointing to a file that exists in the source files of your project, but those source files don't exist on the machines you're installing on. Your sound files should be IN or UNDER the folder containing your EXE. That way they will be in the exact same place relative to the application whether being run on your machine or somewhere else. As such, you must set the Build Action property of your sound file to Content, so that it gets copied to the project output along with the executable.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    14

    Re: problem with DirectX in a project when published

    honestly i'm a bit confused...
    1) if i don't put the line filepath = filepath.Substring(0, filepath.Length - 9) then it wont play the sound...
    2)i go to publish properties -->application files and i put Microsoft.DirectX.AudioVideoPlayback.dll, Microsoft.DirectX.Direct3D.dll, Microsoft.DirectX.dll to "Include". how can i make the file "sounds" to be included?
    3)My sound files are placed inside the main folder of my application
    Also i put my files sounds in the same folder as the exe...still doesn't work...
    4)How can i set the Build Action property of my sound file to Content?
    5)Also i see that it wont play an .exe file that i have in the main folder called "guitar tuner"...i used the same code again like
    filepath = My.Application.Info.DirectoryPath
    filepath = filepath.Substring(0, filepath.Length - 9)

    Process.Start(filepath & "guitar tuner")

    is the problem inside the code or do i need to change something from the properties?
    thanks for helping me...

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: problem with DirectX in a project when published

    When you create a project in VS it creates a folder for that project and puts all the source files in that folder. When you add a sound file to your project it goes in that folder.

    Now, when you build your project it creates an EXE file and places that in an output folder along with any DLLs and other files that are required. When you run your project it's that output that you are running and when you deploy your application its that output that you're deploying.

    When you run your app on another machine, does that machine contain all your VB source code? Of course not. The source files aren't deployed. Only the output is deployed. As such you cannot refer to a sound file in your source folder because, while it may exist on your own machine, it won't exist on any other machine. You can only refer to files in your output because those are the only files that are deployed.

    That means that you need to include the sound file in your output. To do that you need to do as I said and set it's Build Action is Content and its Copy To Output (or something like that) to something other than Do Not Copy. How do you usually set the property of something in VS? You select it and open the Properties window. Once that's done you can go into the Publish properties of the project and just confirm that the sound file is included in the deployment package.

    Note that a Content file is one that will be included in the deployment package "as is", rather than being compiled into the application.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    14

    Re: problem with DirectX in a project when published

    yes! you're absolutely right...now all the files are included but when i run the setup file and i try to install it then the process stops and i get the following error :Cannot download the application. The application is missing required files. Contact the application vendor or your system administrator for assistance.
    Apparently the server cannot find a file named F&236 but i don't have a file named like this...what seems to be the problem?

  8. #8

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    14

    Re: problem with DirectX in a project when published

    the exact details of the error when i try to publish it is :
    COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

    WARNINGS
    There were no warnings during this operation.

    OPERATION PROGRESS STATUS
    * [29/3/2009 14:21:46] : Activation of C:\Documents and Settings\new2008\Επιφάνεια εργασίας\guitarlessons_1_0_0_16.application has started.
    * [29/3/2009 14:21:46] : Processing of deployment manifest has successfully completed.
    * [29/3/2009 14:21:46] : Installation of the application has started.
    * [29/3/2009 14:21:46] : Processing of application manifest has successfully completed.
    * [29/3/2009 14:21:49] : Request of trust and detection of platform is complete.

    ERROR DETAILS
    Following errors were detected during this operation.
    * [29/3/2009 14:21:52] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
    - Downloading file:///C:/Documents and Settings/new2008/Επιφάνεια εργασίας/guitarlessons_1_0_0_16/sounds/F%236.wav.deploy did not succeed.
    - Source: System.Deployment
    - Stack trace:
    at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
    at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
    at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
    at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
    at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
    at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState subState, ActivationDescription actDesc)
    at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut)
    at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
    --- Inner Exception ---
    System.Net.WebException
    - Could not find file 'C:\Documents and Settings\new2008\Επιφάνεια εργασίας\guitarlessons_1_0_0_16\sounds\F%236.wav.deploy'.
    - Source: System
    - Stack trace:
    at System.Net.FileWebRequest.EndGetResponse(IAsyncResult asyncResult)
    at System.Net.FileWebRequest.GetResponse()
    at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
    --- Inner Exception ---
    System.Net.WebException
    - Could not find file 'C:\Documents and Settings\new2008\Επιφάνεια εργασίας\guitarlessons_1_0_0_16\sounds\F%236.wav.deploy'.
    - Source: System
    - Stack trace:
    at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)
    at System.Net.FileWebRequest.WrappedGetResponseCallback(Object state)
    --- Inner Exception ---
    System.IO.FileNotFoundException
    - Could not find file 'C:\Documents and Settings\new2008\Επιφάνεια εργασίας\guitarlessons_1_0_0_16\sounds\F%236.wav.deploy'.
    - Source: mscorlib
    - Stack trace:
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
    at System.Net.FileWebStream..ctor(FileWebRequest request, String path, FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean async)
    at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)

    COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.



    i don't have a sound file named F%236...!!!
    thanks in advance for your help

  9. #9

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    14

    Re: problem with DirectX in a project when published

    ok !i solved the last problem...it seems that it cannot recognize the "#" sign so i changed the name of the sound and the program installed succesfully...BUT!!!same problem occurs with the sounds...i meen the first problem...THEY JUST DON'T PLAY!...i suppose the problem is in the line ""filepath = filepath.Substring(0, filepath.Length - 9)"" because it does not play the specific sounds which use this line...
    i did everything you said about "Build Action is Content and its Copy To Output-->copy always"...still nothing...
    thanks for your help...

  10. #10
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: problem with DirectX in a project when published

    You need to remove that line if your sounds files are now in your application\sounds folder. The copy to output directory should make that work on your development PC as well.

  11. #11

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    14

    Re: problem with DirectX in a project when published

    omg!i guess that's what you were trying to tell but i didn't understand it...you're right it works...but only in the first form...i have another form which presents a slideshow and the code is like this
    Sub slideshow(Optional ByVal playSound As Boolean = True)

    Dim count As Integer = ListBox1.Items.Count
    If count <= 0 Then Exit Sub

    Dim start As Integer = ListBox1.SelectedIndex


    Do

    ListBox1.SelectedIndex = start

    If ws.Checked = True Then

    Select Case ListBox1.Text


    Case "Am.jpg"
    Dim MySound1 As New Microsoft.DirectX.AudioVideoPlayback.Audio("sounds\Am.wav")
    MySound1.Play()
    Case "G.jpg"
    Dim MySound1 As New Microsoft.DirectX.AudioVideoPlayback.Audio("sounds\G.wav")
    MySound1.Play()
    Case "Am(2).jpg"
    .
    .
    .
    .
    this used to work with the previous lines but now not only i can't hear the sounds but there is an error when i start the slideshow...how is that possible?it works for the first form but not for the second...

  12. #12
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: problem with DirectX in a project when published

    Your best bet is to go through your whole program and look at any paths you generate, to make sure they are pointing to the correct files and that the files they are pointing to exist on both your deployment machine and your development machine.

  13. #13

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    14

    Re: problem with DirectX in a project when published

    i don't get it.. when the sound files are getting copied to output directory aren't suppose to be retrieved from any form of an application? i don't know what else to do i've tried everything! and the problem is that i can't use the resources because i have way too many files in there and if i try to add one more then i get errors...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width