原题是:
在VCL的TControl类内定义一个发送消息的方法.声明如下:
Function Perform(Msg:Cardinal;WParam,LParam:longint):longint;
任何一个VCL组件对象可以通过调用Perform方法给组件本身发送消息.
但是必须注意,该函数发出消息后将等待消息处理完后,返回Result;
通过调用Perform方法的调用,实现在组件memo1中自动滚屏到最后一行.
procedure Tform1.scrollToend;
begin
  with memo1 do
    begin
      SelStart:=Length(lines.text);
      Perform(EM_SCROLLCARET,0,0);
      SetFouns;
    end;
end;-------------------------------------------------------------------
谁能把这个弄完把全部代码给我看下....分全部送上.

解决方案 »

  1.   

    这样的问题不需要使用 消息 就可以了...
    with Memo1 do
    begin
      SelStart:=Length(Memo1.Text);
      SelLength:=0;
      SetFocus;
    end;
    执行完毕,光标移到Memo1的末尾。若要移到Memo1末行的起始,同理。
      

  2.   

    不知道你要的效果是什么样的,滚屏可以这样
    var
      P1, P2: Integer;
    begin
      P1 := 0;
      repeat
        Memo1.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
        Application.ProcessMessages;
        P2 := GetScrollPos(Memo1.Handle, SB_VERT);
      until P1 = P2;
    end;循环中间可以加Sleep延时
    EM_SCROLLCARET是针对RichEdit的,且没有滚动效果
      RichEdit1.SelStart := Length(RichEdit1.Text);
      RichEdit1.Perform(EM_SCROLLCARET, 0, 0);
      

  3.   

    Function   Perform(Msg:Cardinal;WParam,LParam:longint):longint; 主要是想看这个方法怎么写.在哪里写.
      

  4.   

    根据 wParam的取值有以下
    SB_BOTTOM 
    SB_ENDSCROLL 
    SB_LINEDOWN 
    SB_LINEUP
    SB_PAGEDOWN 
    SB_PAGEUP 
    SB_THUMBPOSITION 
    SB_THUMBTRACK
    SB_TOPprocedure   Tform1.scrollToend;
    begin
        with   memo1   do
            begin
                SelStart:=Length(lines.text);
                Perform(WM_VSCROLL,SB_BOTTOM,0);
                SetFouns;
            end;
    end; 
      

  5.   

    SB_BOTTOM   
    SB_ENDSCROLL   
    SB_LINEDOWN   
    SB_LINEUP 
    SB_PAGEDOWN   
    SB_PAGEUP   
    SB_THUMBPOSITION   
    SB_THUMBTRACK 
    SB_TOP procedure       Tform1.scrollToend; 
    begin 
            with       memo1       do 
                    begin 
                            SelStart:=Length(lines.text); 
                            Perform(WM_VSCROLL,SB_BOTTOM,0); 
                            SetFouns; 
                    end; 
    end;