BYTE *GetData(CString *pString)
{
if(pString == NULL)
return NULL;
HMMIO file1;//定义HMMIO文件句柄;
file1 = mmioOpen((LPTSTR)pString,NULL,MMIO_READWRITE);//以读写模式打开所给的WAVE文件;
if(file1==NULL)
{
::MessageBox(NULL,_T("WAVE文件打开失败!"),_T("haha"),MB_OK);
return NULL;
}......这是一个函数的一部分.我想在DLG类中调用他打开一个已存在的音频文件..但是总是提示文件打开失败..
void CMy::OnBnClickedButton1()
{ // TODO: 在此添加控件通知处理程序代码;
CString pString;
pString = ("c:\\g2.wav");
GetData(&pString) ;
}
这是为什么呀?些文件我八用符件带的录音机录的.已存好了.
{
if(pString == NULL)
return NULL;
HMMIO file1;//定义HMMIO文件句柄;
file1 = mmioOpen((LPTSTR)pString,NULL,MMIO_READWRITE);//以读写模式打开所给的WAVE文件;
if(file1==NULL)
{
::MessageBox(NULL,_T("WAVE文件打开失败!"),_T("haha"),MB_OK);
return NULL;
}......这是一个函数的一部分.我想在DLG类中调用他打开一个已存在的音频文件..但是总是提示文件打开失败..
void CMy::OnBnClickedButton1()
{ // TODO: 在此添加控件通知处理程序代码;
CString pString;
pString = ("c:\\g2.wav");
GetData(&pString) ;
}
这是为什么呀?些文件我八用符件带的录音机录的.已存好了.
解决方案 »
- MDI工程 菜单动态如何生成视图
- 如何在Dialog应用程序中调用OnIdle函数!?!??!?
- 请问在VC中如何将双精度型转换成字符串型?进者有分!!!!!!!!!!!!!!!!!!!!!!!!!
- 再次请教FtpCommand的问题(程序见内)
- 如何将其它程序显示的窗口嵌入到自己的SDI窗口中?(内空)
- 如何用Win32 API显示图像
- 我用一个对话框上的按纽创建了一个新的对话框,为什么新的一直在老的上面?
- 在系统集成时遇到的问题
- MFC中哪个窗口类用来创建自绘的弹出式窗口开销比较小?
- 关于CArray...,向你请教...
- 使用VS2005+Access2007中,在增加新的一行时有两个疑问,请帮忙看看
- 动态库项目编译后只产生dll,没有lib,这是怎么回事呢?
Return ValuesReturns a handle of the opened file. If the file cannot be opened, the return value is NULL. If lpmmioinfo is not NULL, the wErrorRet member of the MMIOINFO structure will contain one of the following error values.Value Description
MMIOERR_ACCESSDENIED The file is protected and cannot be opened.
MMIOERR_INVALIDFILE Another failure condition occurred. This is the default error for an open-file failure.
MMIOERR_NETWORKERROR The network is not responding to the request to open a remote file.
MMIOERR_PATHNOTFOUND The directory specification is incorrect.
MMIOERR_SHARINGVIOLATION The file is being used by another application and is unavailable.
MMIOERR_TOOMANYOPENFILES The number of files simultaneously open is at a maximum level. The system has run out of available file handles.
问题的原因可能是:GetData(CString *pString)这个函数的参数定义为 CString 的指针了。==========================================我的解决方法:mmioOpen 函数定义如下:
HMMIO mmioOpen(
LPSTR szFilename,
LPMMIOINFO lpmmioinfo,
DWORD dwOpenFlags
);所以定义函数如下:GetData( LPSTR szFilename )
{
mmioOpen( szFilename , NULL ...调用时,改为如下:CString pString("c:\\g2.wav");
GetData( pString.GetBuffer(0) );
我用的2005谢谢大家..