偶有一DLL,如下,是求计算机名字的,可以用,
但是求出名字后就出现错误对话框,INVALID POINTER OPERATION
不知道为什么哪位大侠知道不吝赐教library Project2;uses
  SysUtils,windows,
  Classes;function GetName:String;stdcall;
var
  pcComputer: PChar;
  dwCsize: DWORD;
begin
  { TODO : 取得名字}
  dwCsize := MAX_COMPUTERNAME_LENGTH + 1;
  result := '';
  GETMEM(pcComputer, dwCsize);
  try
    if windows.GetComputerName(pcComputer, dwCsize) then
      result := pcComputer;
  finally
    freemem(pcComputer);
  end;
end;
{$R *.res}
     exports  GetName;
begin
end.调用方法:      function GetName:STRING;STDCALL EXTERNAL 'D:\tt\Project2.dll';
      {$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
VAR NAME:STRING;
begin
   NAME:=GetName;
   SHOWMESSAGE(name);end;