Solved

HELP playing .wav file in VB6 using MMControl

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

16 Experts available now in Live!

Get 1:1 Help Now