比如
var
ip:PAnsiChar;
command:PAnsiChar;
....command;='net send'+ip+'hello';报错
incompatible types:'string'and 'PAnsiChar'

解决方案 »

  1.   

    command := PAnsiChar( 'net send' + ip+'hello' );
      

  2.   

    var
      ip: PAnsiChar;
      command: PAnsiChar;
      temp: String;
    begin
      temp:= 'net send '+ ip +'hello';
      copmmand:= PAnsiChar(temp);
    end;
      

  3.   

    Command:=PChar('net send'+StrPas(ip)+'hello');
      

  4.   

    GetMem(command,255);
    GetMem(ip,255);
    StrCopy(ip,'Test');
    StrCopy(Command,'net send');
    StrCat(Command,ip);
    StrCat(Command,'hello');
    FreeMem(ip);
    FreeMem(command);
      

  5.   

    你定义一个String类型的变量,
    然后。
    这么和你说:
    var
      A, B, D: PChar;
      C: String;
    begin
      C := StrPas (A) + StrPas (B);
      D := PChar (C);
      //或者》》
      //D := PChar (StrPas (A) + StrPas (B));
    end;