请教sendmessgeyong用法的一个不明白的地方 (100分)

  • 主题发起人 主题发起人 cnhngujun
  • 开始时间 开始时间
C

cnhngujun

Unregistered / Unconfirmed
GUEST, unregistred user!
我是一个delphi的新手,有一本杂志介绍一个QQ辅佐发送工具
我照着输入到delphi7中,却无法执行完整;
procedure TForm1.BitBtn1Click(Sender: TObject);
var hparent,hbutton,hmemo:hwnd;
begin
Memo1.SelectAll;
memo1.CopyToClipboard;
try
hparent:=findwindow(nil,'对话模式');

hmemo:=childwindowfrompointex(hparent,point(50,350),cwp_all);

hbutton:=findwindowex(hparent,0,nil,'送讯息(&S)');

if (hparent=0) or (hmemo=0) or (hbutton=0) then
messagebox(handle,'error','error',mb_iconwarning[red])//此处经常发生错误,但如果
//打开qq发送消息窗口不做任何事倒也 能行
//但qq发送消息窗口老是提示'不能发送空消息'
//我查看了Clipboard,里面有我的文本[/red]
else
begin
sendmessage(hmemo,WM_PASTE,0,0);//那一定是这里的问题了,
//但qq发送消息窗口老是提示'不能发送空消息'
sendmessage(hbutton,bm_click,0,0);
end;
except
messagebox(handle,'2','2',mb_iconwarning);
end;
end;
请各位大虾给个答案,谢了!!
 
sendmessage(hbutton,bm_click,0,0);
改成:
SendMessage(hbutton,WM_LBUTTONDOWN,MK_LBUTTON,0);
SendMessage(hbutton,WM_LBUTTONUP,MK_LBUTTON,0);
 
azw84611,你好 ,谢谢你的解答,
不过sorry,我刚才问题写错了一点地方,是sendmessage(hmemo,WM_PASTE,0,0);
这行的问题,请再次回答,谢了!!
 

SendMessage(hbutton, WM_SETFOCUS, 0, 0);
试一下。
 
[red]sorry!! 我刚才问题写错了一点地方,是sendmessage(hmemo,WM_PASTE,0,0)语句
这行有问题,请再次回答,谢了!![/red]
 
先SendMessage(hmemo, WM_SETFOCUS, 0, 0);
再sendmessage(hmemo,WM_PASTE,0,0)
试一下。

或者直接用
s := 'hello, world.';
for i := 1 to length(s) do
SendMessage(hmemo, WM_CHAR, ord(s), 0);
发送字符。
 
谢,那我先试一下
 
zw84611在请教一个问题
hmemo:=childwindowfrompointex(hparent,point(50,350),cwp_all);
好象也不对,如何用childwindowfrompointex
 
后退
顶部