function mciSendString(lpstrCommand, lpstrReturnString: PChar;
  uReturnLength: UINT; hWndCallback: HWND): MCIERROR; stdcall;
看到返回的MCIERROR了吧

解决方案 »

  1.   

    什么?
    var returnstring:pchar;
    begin
    returnstring:='驱动器关闭错误';
    pchar和string没搞清楚var 
      mci:string;
      mciid:integer;
    begin
      mciid:=mcigetdeviceid(nil);
      mci:='setaudio '+inttostr(mciid)+ ' off';
      mcisendstring(pchar(mci),0,nil,0);
    end; 
      

  2.   

    API声明:
    MCIERROR mciSendString(LPCTSTR lpszCommand, LPTSTR lpszReturnString,
        UINT cchReturn, HANDLE hwndCallback);关于返回值的参数:lpszReturnStringAddress of a buffer that receives return information. If no return information is needed, this parameter can be NULL. cchReturnSize, in characters, of the return buffer specified by the lpszReturnString parameter. 
    所以在cchReturn里写返回参数的buffer大小,返回值在lpszReturnString
    指针指向的内存区里,长度是cchReturn的大小
      

  3.   

    var returnstring:pchar;
    begin
      GetMem(returnstring, 128);
      mciSendString('set CDAudio door closed', returnstring, 127, 0);
    end;

      mciSendString('set CDAudio door closed', Nil, 0, 0);