?
Solved

HELP playing .wav file in VB6 using MMControl

Posted on 2014-01-11
3
Medium Priority
?
964 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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…
Suggested Courses

649 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