#include <windows.h>
#pragma comment(lib,"winmm.lib")
int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,
LPSTR lpszArgument,int nFunsterStil)
{
TCHAR fileName[]="G:\\音乐\\she&aimini\\沿海公路得出口.mp3";
TCHAR shortName[MAX_PATH];
GetShortPathName(fileName,shortName,sizeof(shortName)/sizeof(TCHAR));
TCHAR cmd[MAX_PATH+10];
wsprintf(cmd,"play %s",shortName);
mciSendString(cmd,"",NULL,NULL);
return 0;
}
这是我昨晚逛了一些网站,根据那些例子写出来的,可是错误很多。
c:\tc\micsendstring\main.c(11) : error C2275: 'TCHAR' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\winnt.h(189) : see declaration of 'TCHAR'
c:\tc\micsendstring\main.c(11) : error C2146: syntax error : missing ';' before identifier 'cmd'
c:\tc\micsendstring\main.c(11) : error C2065: 'cmd' : undeclared identifier
c:\tc\micsendstring\main.c(11) : error C2109: subscript requires array or pointer type
c:\tc\micsendstring\main.c(12) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int '
c:\tc\micsendstring\main.c(12) : warning C4024: 'wsprintfA' : different types for formal and actual parameter 1
c:\tc\micsendstring\main.c(13) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
c:\tc\micsendstring\main.c(13) : warning C4024: 'mciSendStringA' : different types for formal and actual parameter 1
c:\tc\micsendstring\main.c(13) : warning C4047: 'function' : 'unsigned int ' differs in levels of indirection from 'void *'
c:\tc\micsendstring\main.c(13) : warning C4024: 'mciSendStringA' : different types for formal and actual parameter 3
执行 cl.exe 时出错.
各位帮个忙。一直弄不懂要怎么用这个函数。