procedure inisms;
var
senddata:string;
begin
//if not mscomm1.PortOpen then
//exit;
senddata:='AT+CMGF=1'+chr(13);
mscomm1.output:=senddata;
senddata:='AT+CSCA=8613010370500'+chr(13);
mscomm1.Output:=senddata;
end;
这里mscomm1.output:=senddata;出错
[Error] smst1.pas(68): Undeclared identifier: 'mscomm1'
这里我打了mscomm1然后打了'.'后就出错后面的属性也不出来

解决方案 »

  1.   

    >>Undeclared identifier: 'mscomm1'
    你看, 出錯的提示是說找不到 mscomm1, 這說明你都沒正确專明了 mscomm1呢! 
    其它的進一步的更不用說了!!
      

  2.   

    没有引用mscomm1的单元
    mscomm这个控件是第三方的,请在projects->options的相应路径设置中添加库文件和包文件的搜索路径
      

  3.   

    unit sms;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, OleCtrls, MSCommLib_TLB;type
      TForm1 = class(TForm)
        MSComm1: TMSComm;
        Label1: TLabel;
        Label2: TLabel;
        Memo1: TMemo;
        Edit1: TEdit;
        function OpenPort():Boolean;
        procedure inisms();
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    function TForm1.OpenPort:Boolean;
    begin
    //更新mscomm的设置
     try
       mscomm1.CommPort:=3;
       mscomm1.Settings:='9600,n,8,1';
       mscomm1.InBufferSize:=1024;
       mscomm1.InBufferCount:=0;
       mscomm1.InputMode:=1;
       mscomm1.InputLen:=0;
       mscomm1.PortOpen:=true;
       OpenPort:=mscomm1.PortOpen;
     except
       OpenPort:=false;
       //messagebox(self.Handle,pchar('串口‘+pchar(intToStr(mscomm1.commport))+'打开失败!,请更换其他串口'),'串口打开失败',MB_OK);
       end;
       end;
    procedure inisms;
    var
     senddata:string;
     begin
     //先判断串口是否打开//这里就出现错误了 if  mscomm1.//编译在这里我打入mscomm1然后敲入‘.‘后就出现错误了错误信息是
    //[Pascal Error] sms.pas(1): Unable to invoke Code Completion due to errors in source code
    //下面是继续源代码
     exit;
     senddata:='AT+CMGF=1'+chr(13);
     mscomm1.
    end.
      

  4.   

    procedure inisms;  //錯誤地方
    var
     senddata:string;
     begin
     //先判断串口是否打开
    //这里就出现错误了改為如下就可了
    procedure TForm1.inisms;
    ...
      

  5.   

    你程序中的mscomm1是什么类型?是TMSComm吗?在哪声明的?如果没声明或声明不对,就会出错啊。
      

  6.   

    procedure inisms;
    var
     senddata:string;
     begin if  Form1.mscomm1. 
       exit;
     senddata:='AT+CMGF=1'+chr(13);
     Form1.mscomm1.
    end.
      

  7.   

    aiirii(aiirii)已经说得很清楚了。