VC用Windows Media Player播放视频函数

void PlayWithWMP( char * pFileName)
{
 char strTempFileName[MAX_PATH]={0};
 strTempFileName[0]='\"';
 memcpy(strTempFileName+1,pFileName,strlen(pFileName));
 strTempFileName[strlen(pFileName)+1] = '\"'; //AfxMessageBox(strTempFileName); //return;

 
 char strwindowsdir[MAX_PATH]={0};
 GetWindowsDirectory(strwindowsdir,MAX_PATH);
 
 char strWMPdir[MAX_PATH]={0};
 memcpy(strWMPdir,strwindowsdir,3);
 strcat(strWMPdir,"\Program Files\\Windows Media Player\\wmplayer.exe\"");
 
 
 memcpy(strWMPdir+1, strWMPdir,strlen(strWMPdir));
 
 memset(strWMPdir,'\"',1);
 
 strcat(strWMPdir," ");//strcat(strWMPdir," - ");
 
 strcat(strWMPdir, strTempFileName/*pFileName*//*"G:\\1.avi"*/);   //AfxMessageBox(strWMPdir);
 
 WinExec(strWMPdir,SW_SHOWMAXIMIZED);
 
 }

你可能感兴趣的:(VC用Windows Media Player播放视频函数)