我是想问,怎么给他发字符串,
因为响应这个消息的(application.onmessage)的过程中要用到这个字符串。

解决方案 »

  1.   

    可是我要一个字符串而且是中文的。
    delphi帮助中有个例子
    const
     WM_FILEREADY = WM_USER + 2000;
    procedure TForm1.FormCreate(Sender: TObject);begin
      Application.OnMessage := AppMessage;
    end;procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
    begin
      if Msg.message = WM_FILEREADY then
      begin
        Memo1.Lines.LoadFromFile(StrPas(PChar(Msg.lParam)));
        Handled := True;  end;  { for all other messages, Handled remains False }
      { so that other message handlers can respond }
    end;
    但不知道发消息时他的lparam怎么设的
      

  2.   

    先将某程序置为Activate,再用钩子(HOOK技术)发送字符串。
      

  3.   

    "但不知道发消息时他的lparam怎么设的"
    看我的.sendmessage(yourhandle,WM_SETTEXT,0,laparam(pchar(youstring)));
    之所以用WM_SETTEXT,因为我试过用自定义的消息好像指针不能正确传递.
    大家再试试吧. 
      

  4.   

    mc_music:你的方法不行,根本就不响应Wm_settext消息
      

  5.   

    用指针
    var
    str:string;
    s:^string;
    s:=@str;SendMessage(你的handle,消息,wparam,integer(s))
    收到消息后
    在用
    s:=lparam;
    则S^就是字符串的内容