Solved

HELP playing .wav file in VB6 using MMControl

Posted on 2014-01-11
3
849 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

862 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now