[問題] mciGetErrorString 產生的error msg

看板C_and_CPP (C/C++)作者 (熊仔)時間15年前 (2011/05/17 23:30), 編輯推噓-1(010)
留言1則, 1人參與, 最新討論串1/1
小弟我最近在VC2008上想要做出播放背景音樂的功能 所以使用了 MCI的功能 其中mciGetErrorString出現的error msg是 " 載入指定的裝置驅動程式時發生了不明的問題。 " 請問這段error msg 該如何解決,或是我有哪些動作沒有先處理的? 以下附上整段code: #include <windows.h> #include <stdio.h> #include <mmsystem.h> #include <shellapi.h> #include <AFXCOM_.H> #pragma comment(lib,"winmm.lib") void main() { char str[128]={0}; int i = 0; wchar_t buf[128]; MCI_OPEN_PARMS mciOpen; MCIERROR mciError; mciOpen.lpstrDeviceType = L"mpegvideo"; mciOpen.lpstrElementName = L"c:\\wwwcut1.mp3"; mciError = mciSendCommand(0,MCI_OPEN,MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,(DWORD)&mciOpen); if(mciError) { mciGetErrorString(mciError,buf,128); DWORD ws; WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),buf,wcslen(buf),&ws,NULL); //printf("%s\n",buf); goto Error; } // end if(mciError) UINT DeviceID = mciOpen.wDeviceID ; MCI_PLAY_PARMS mciPlay; mciError = mciSendCommand(DeviceID,MCI_PLAY,0 ,(DWORD)&mciPlay); if(mciError) { printf("send MCI_PLAY command failed\n"); goto Error; } // end if(mciError) while(1) { sprintf(str,"播放時間:\t%d",i); printf("%s\r",str); i++; Sleep(1000); } // end while Error: system("pause"); } // main() -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.25.149.83

05/18 07:56, , 1F
說好的排版呢 ┐(─_─)┌
05/18 07:56, 1F
抱歉,已排版 ※ 編輯: kuramax77 來自: 114.25.149.83 (05/18 08:31)
文章代碼(AID): #1DqfIM7i (C_and_CPP)
文章代碼(AID): #1DqfIM7i (C_and_CPP)