这里面有的到窗口句柄,输入框句柄和按钮句柄的方法!
你可以结合使用的到你想的到的功能!
这是一个qq自动发送的功能,你看看,应该有点用吧!:)

delphi代码
  1. procedure TForm1.Button1Click(Sender: TObject);   
  2. var  
  3. hParent,hButton,hMemo: HWND;   
  4. begin  
  5. Memo1.CopyToClipboard;//把Memo中选中的语句拷贝到剪贴板中  
  6. try  
  7. //找发送消息的QQ窗口  
  8. hParent := FindWindow(nil'发送消息');   
  9. //然后找回话时用的编辑窗口,Point函数用于返回一个TPoint类型变量  
  10. hMemo := ChildWindowFromPointEx(hParent, Point(50100), CWP_ALL);   
  11. //找到“送讯息”按钮的句柄   
  12. hButton := FindWindowEx(hParent,0,nil,'送讯息(&S)');   
  13. if (hParent = 0or (hMemo = 0or (hButton = 0then  
  14. MessageBox(Handle,'没有找到发送窗口,请重试!','错误',MB_ICONWARNING)   
  15. else  
  16. begin  
  17. //向发送消息中的回话编辑框发送粘贴消息  
  18. SendMessage(hMemo,WM_PASTE,0,0);   
  19. //向“送讯息”按钮送单击消息以模仿按键发送回话  
  20. SendMessage(hButton,BM_CLICK,0,0);   
  21. end;   
  22. except  
  23. //如果发生以外错误给出提示  
  24. MessageBox(Handle,'发送消息出错,请重试!','错误',MB_ICONWARNING);   
  25. end;   
  26. end;

 

 

Last modification:August 16, 2009
稀罕你