***三部分,发送**************88
DECLARE INTEGER FindWindowEx IN user32 ;
  INTEGER hwndParent,;
  INTEGER hwndChildAfter,;
  STRING @ lpszClass,;
   STRING @ lpszWindow
  DECLARE INTEGER GetForegroundWindow IN user32
  DECLARE  INTEGER SendMessage IN user32 INTEGER,INTEGER,INTEGER,STRING @
  DECLARE  INTEGER GetClassName IN user32 INTEGER,STRING @,INTEGER
  DECLARE INTEGER GetWindow IN user32; 
    INTEGER hwnd,;  
    INTEGER wFlag
    BM_CLICK = 0xF5 
    EM_REPLACESEL = 0xC2
    ************
    ***二部分,内容填写 **************88
    
    SendMg='准备发送的内容:'&&指定要发送的消息
    qqHwnd=GetForegroundWindow()&&得到当前窗口句柄
    ClassName=REPLICATE(CHR(0),255) 
    GetClassName(qqHwnd,@ClassName,LEN(ClassName))&&窗口类型
IF ALLTRIM(ClassName)='#32770'&&初步判定是否是聊天窗口
 FirstHwnd=findWindowEx(qqHwnd, 0, "#32770", NULL)&&获得第一个子窗口  
  IF FirstHwnd<>0    
 SendHwnd = FindWindowEx(FirstHwnd, 0, "Button", "发送(S)")&&获得发送按钮句柄  
     IF SendHwnd<>0        
 ListHwnd=findWindowEx(FirstHwnd, 0, "RichEdit20A", NULL)&&获得聊天记录窗口句柄  
      EditHwnd=GetWindow(GetWindow(ListHwnd,2),5)&&根据聊天记录窗口得到输入窗口句柄    
        IF EditHwnd<>0        
     SendMessage(EditHwnd, EM_REPLACESEL,0,SendMg)&&往输入框自动发送消息   
         SendMessage(SendHwnd, BM_CLICK,0,0)&&自动按下'发送'按钮     
      ENDI     
   ENDI 
   ENDI
 ENDI

 

 

哪里有问题导致没有发送成功/