首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

mciSendString 不出声音 如其mciSendString("play c:/1.mp3")就有声音 换成数组表示路径就没有

2013-07-09 
mciSendString 不出声音 如果mciSendString(play c:/1.mp3....)就有声音 换成数组表示路径就没有case ID

mciSendString 不出声音 如果mciSendString("play c:/1.mp3"....)就有声音 换成数组表示路径就没有
        case IDC_OK:
{
OPENFILENAME ofn;
char szFile[MAX_PATH];
ZeroMemory(&ofn,sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = TEXT('\0');
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = TEXT("ALL\0*.*\0Text\0*.TXT\0");
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.hwndOwner = hwnd;
ofn.Flags = OFN_EXPLORER |OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
{
TCHARshortPath[50];
TCHARp[70];
//mciSendString("stop mymusic",NULL,0,NULL);
GetShortPathName(szFile,shortPath,sizeof(shortPath));
wsprintf(p,"paly %s",shortPath);
mciSendString(p,NULL,0,NULL);
SetDlgItemText(hwnd,IDC_EDIT1,szFile);
}


} C API mciSendString
[解决办法]

        case IDC_OK:
 {
 OPENFILENAME ofn;
 TCHAR szFile[MAX_PATH];
 ZeroMemory(&ofn,sizeof(ofn));
 ofn.lStructSize = sizeof(ofn);
 ofn.lpstrFile = szFile;
 ofn.nMaxFile = sizeof(szFile);
 ofn.lpstrFilter = _T("ALL\0*.*\0Text\0*.TXT\0");
 ofn.nFilterIndex = 1;
 ofn.lpstrFileTitle = NULL;
 ofn.nMaxFileTitle = 0;
 ofn.lpstrInitialDir = NULL;
 ofn.hwndOwner = hwnd;
 ofn.Flags = OFN_EXPLORER 
[解决办法]
OFN_PATHMUSTEXIST 
[解决办法]
 OFN_FILEMUSTEXIST;
 if (GetOpenFileName(&ofn))
 {
 TCHAR shortPath[50];
 TCHAR p[70];
 GetShortPathName(szFile,shortPath,sizeof(shortPath));
 _stprintf(p,_T("paly %s"),shortPath);
 mciSendString(p,NULL,0,NULL);
 SetDlgItemText(hwnd,IDC_EDIT1,szFile);
 }


 }

热点排行