illegal use of this type as an expression
2013-09-11 20:25
288 查看
学习MCI时看别人样例手敲代码出现的一个很经典的错误。
在C语言中定义的变量没有放在函数的开头。
在C语言中定义的变量没有放在函数的开头。
#include <string.h> #include <windows.h> #include <Digitalv.h> #include <mmsystem.h> #pragma comment(lib, "winmm.lib") int main() { char buf[128]; MCI_OPEN_PARMS mciOpen; MCIERROR mciError; UINT DeviceID; MCI_PLAY_PARMS mciPlay; mciOpen.lpstrDeviceType = L"mpegvideo"; mciOpen.lpstrElementName = L"year.mp3"; mciError = mciSendCommand(0, MCI_OPEN,MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)&mciOpen); if(mciError) { mciGetErrorString(mciError, (LPWSTR)buf, 128); MessageBox(NULL, TEXT("send MCI_OPEN command failed"), TEXT("ERROR"), 0); return; } DeviceID = mciOpen.wDeviceID; mciError = mciSendCommand(DeviceID, MCI_PLAY, MCI_WAIT | MCI_DGV_PLAY_REPEAT, (DWORD)&mciPlay); if(mciError) { mciGetErrorString(mciError, (LPWSTR)buf, 128); MessageBox(NULL, TEXT("send MCI_PLAY command failed"), TEXT("ERROR"), 0); return; } return 0; }
相关文章推荐
- 'PIO_STACK_LOCATION' : illegal use of this type as an expression
- error C2275: "xxx"illegal use of this type as an expression
- illegal use of this type as an expression 解决方案
- 'PIO_STACK_LOCATION' : illegal use of this type as an expression
- VC6.0中出现的“illegal use of this type as an expression”错误及其解决办法
- error C2275: 'xxx' : illegal use of this type as an expression
- error C2275: 'xxx' : illegal use of this type as an expression
- C语言编程调试:illegal use of this type as an expression错误解决办法
- error C2275! illegal use of this type as an expression
- error C2275: 'xxx' : illegal use of this type as an expression
- error C2275: ‘XXX’ : illegal use of this type as an expression 报错的解决方法!
- illegal use of this type as an expression
- 'FILE' : illegal use of this type as an expression编译错误的解决
- 'FILE' : illegal use of this type as an expression编译错误的解决
- error C2275: 'FILE' : illegal use of this type as an expression
- 'FILE' : illegal use of this type as an expression编译错误的解决
- C2275 illegal use of this type as an expression
- error C2275: 'FILE' : illegal use of this type as an expression
- error C2275 : 'UNICODE_STRING' :illegal use of this type as an expression
- 编译选项引发的ERROR C2275:illegal use of this type as an expression