大部分API delphi已经封装了
少数要用调用动态连接库,或用函数指针来

解决方案 »

  1.   

    在  uses 后面加上 Shellapi
      

  2.   

    To:xueyin(雪莹) 
    这个也太片面了,ShellApi只是封装了与外壳有关的api
    比如MCI系列API,就要uses mmsystem
      

  3.   

    以下是一个调用API获得用户名的例子:
    procedure TForm1.Button1Click(Sender: TObject);
    var
       pcUser   : PChar;
       dwUSize : DWORD;
    begin
       dwUSize := 21; // user name can be up to 20 characters
       GetMem( pcUser, dwUSize ); // allocate memory for the string
       try
          if Windows.GetUserName( pcUser, dwUSize ) then
             edit1.Text := pcUser
       finally
          FreeMem( pcUser ); // now free the memory allocated for the string
       end;
    end;