Article View: comp.lang.basic.visual.misc
Article #274Re: Playing a wav file through MCI
From: Gale Green
Date: Sat, 19 Jun 2004 14:40
Date: Sat, 19 Jun 2004 14:40
60 lines
3006 bytes
3006 bytes
On 19 Jun 2004 06:37:40 -0700, estudiantin@rediffmail.com (Curious
Student) wrote:
> I get an error while playing a wav file. I am using VB6 and the MCI
> (winmm.dll) interface. But the front end doesn't matter. I need help
> resolving an error that MCI throws back on me when I open the device.
> The error comes as a return value to the "Open" string message.
I copied all your code into a new project, added declarations for all
the variables, and it worked first time.
I believe you may be missing a link in SYSTEM.INI:
waveaudio=mciwave.drv
in group [mci]
You don't say which version of Windows you're using but I believe the
code below will work on all versions because on NT clones
WritePrivateProfileString maps accesses to system INI files to the
registry automatically.
However, if you have Win 95/98/Me, and this project is just for your
own use, then you can edit SYSTEM.INI manually, to include the above
line.
Gale.
===============
Private Declare Function GetWindowsDirectory _
Lib "kernel32" _
Alias "GetWindowsDirectoryA" ( _
ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Private Declare Function WritePrivateProfileString _
Lib "kernel32" _
Alias "WritePrivateProfileStringA" ( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpString As Any, _
ByVal lpFileName As String) As Long
Dim MyLen As Long, _
Temp As String * 255, _
WinDir As String, _
DeviceType As String, _
DriverName As String
DeviceType = "waveaudio"
DriverName = "mciwave.drv"
MyLen = GetWindowsDirectory(Temp, 255)
WinDir = Left$(Temp, MyLen)
MyLen = WritePrivateProfileString( _
"MCI", _
DeviceType, _
DriverName, _
WinDir & "\system.ini")
Technical Details
Message-ID:
<opi8d0dp6fs82s4mm6v53mtmeh5j8u1f2t@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.cwix.com!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gblReferences:
<c520b56a.0406190537.16054229@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110e3b,2c9122eb691bb6cd X-Google-Thread: 115960,15636ed7f848530e X-Google-Thread: 11493c,8f82aaf06c0da2aa X-Google-Thread: fa7d6,4ef6ea2241c4e51f X-Google-Attributes: gid110e3b,gid115960,gid11493c,gidfa7d6,public From: Gale Green <gale@databeat.fsnet.co.uk> Subject: Re: Playing a wav file through MCI Date: Sat, 19 Jun 2004 15:40:14 +0100 Message-ID: <opi8d0dp6fs82s4mm6v53mtmeh5j8u1f2t@4ax.com> References: <c520b56a.0406190537.16054229@posting.google.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Newsgroups: comp.lang.basic.visual.misc,comp.os.ms-windows.programmer.multimedia,microsoft.public.vb.general.discussion,borland.public.delphi.multimedia NNTP-Posting-Host: modem-3308.antelope.dialup.pol.co.uk 217.134.28.236 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.cwix.com!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl Lines: 1