Solved

HELP playing .wav file in VB6 using MMControl

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Release Dynamically Allocated Memory in C# 3 38
backup program with robocopy 6 45
VBA to find and replace multiline text from VBA modules 8 64
Code enhancement 4 22
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…

829 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