Solved

HELP playing .wav file in VB6 using MMControl

Posted on 2014-01-11
3
895 Views
Last Modified: 2014-01-21
[Using VB6 on Windows 7 64-bit machine]

Why won't my VB6 application allow me to play audio files from the application folder? I can play anything I want if I put it in the Windows Media folder----but I want to keep my media in the same folder as my VB6 application files and just load it from there. Any ideas?

Win7 says I have administrator account permissions, but all the check boxes etc on the security permissions of the folder for my application are greyed out. It seems that I have an admin account in name only...... any help is greatly appreciated.

Here's my code that works.....

MMControl2.Command = "Close"
MMControl2.Notify = False
MMControl2.Wait = True
MMControl2.Shareable = False
MMControl2.FileName = "C:\Windows\Media\BaseballCrowd.wav"
MMControl2.Command = "Open"
MMControl2.Command = "Play"


Here's the filename\path that does not work:

MMControl2.FileName = App.Path & "\BaseballCrowd.wav"
0
Comment
Question by:jazjef
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 39774337
Try with \\ instead of \


MMControl2.FileName = "C:\\Windows\\Media\\BaseballCrowd.wav"

If does not work, try with admin mode.

Below one example for running notepad in admin rights. Likewise, modify your code accordingly.  HTH.

 
Dim procStartInfo As New ProcessStartInfo
    Dim procExecuting As New Process

    With procStartInfo
        .UseShellExecute = True
        .FileName = "Notepad.exe"
        .WindowStyle = ProcessWindowStyle.Normal
        .Verb = "runas" 'add this to prompt for elevation
    End With

    procExecuting = Process.Start(procStartInfo)

Open in new window

0
 
LVL 4

Accepted Solution

by:
jazjef earned 0 total points
ID: 39787616
Solution:
You cannot have parentheses (   ) within your App.Path ..... if your path is something like "C:\Users\SomeUser\Documents\MyVB6App (version 003)" it will not play the file. Remove the parentheses and it will play.
0
 
LVL 4

Author Closing Comment

by:jazjef
ID: 39796495
It's the solution to my problem.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question