Board index » Visual Studio » Error when saving voice using mciSendString

Error when saving voice using mciSendString

Visual Studio377
I am using the following line of code to save a voice file (.wav) to

disk and it works fine when the filename contains no spaces. However

the file doesn't get saved when its name contains a space. Does anyone

know what is going wrong and how I can fix it ?





nReturn = mciSendString("save Voice1 " & m_sVoiceFile, "0", 0, 0)


-
 

Re:Error when saving voice using mciSendString

"BigC" <christopher.smith2@baesystems.com>schrieb:

Quote
I am using the following line of code to save a voice file (.wav) to

disk and it works fine when the filename contains no spaces. However

the file doesn't get saved when its name contains a space. Does anyone

know what is going wrong and how I can fix it ?



nReturn = mciSendString("save Voice1 " & m_sVoiceFile, "0", 0, 0)



Untested: Surround the path with double quotation characters

('ControlChars.Quote' or two consecutive double quotes inside a string

literal) or convert it to the old 8.3 path format (this is IMO only possible

using p/invoke calls too).



--

M S Herfried K. Wagner

M V P <URL:dotnet.mvps.org/>">dotnet.mvps.org/>

V B <URL:dotnet.mvps.org/dotnet/faqs/>">dotnet.mvps.org/dotnet/faqs/>



-

Re:Error when saving voice using mciSendString

On 4 Jun, 21:03, "Herfried K. Wagner [MVP]" <hirf-spam-me-h...@gmx.at>

wrote:

Quote
"BigC" <christopher.smi...@baesystems.com>schrieb:



>I am using the following line of code to save a voice file (.wav) to

>disk and it works fine when the filename contains no spaces. However

>the file doesn't get saved when its name contains a space. Does anyone

>know what is going wrong and how I can fix it ?



>nReturn = mciSendString("save Voice1 " & m_sVoiceFile, "0", 0, 0)



Untested: Surround the path with double quotation characters

('ControlChars.Quote' or two consecutive double quotes inside a string

literal) or convert it to the old 8.3 path format (this is IMO only possible

using p/invoke calls too).



--

M S Herfried K. Wagner

M V P <URL:dotnet.mvps.org/>">dotnet.mvps.org/>

V B <URL:dotnet.mvps.org/dotnet/faqs/>">dotnet.mvps.org/dotnet/faqs/>



The ControlChars.Quote work a treat, thanks :-)



-