#include<tlhelp32.h>
#include<windows.h>
#include <time.h>HINSTANCE hInst; 
HWND hWnd;/**************         程序ID定义  ******************/ 
 
#define id_Send 0x77E                         //发送按扭的ID 
#define id_SendQQMsg 1001                     //控制发送QQ消息的定时器ID int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 

HWND hFore, hChat, hParent;  
 
char szTest[] = "这是我的QQ主页哦! http://user.qzone.qq.com/406960655 \"; 
HWND hWnd=NULL; 
char name[200]; 
int len; 
char ch[3] = {0, 0, 0}; 
while(hWnd=FindWindowEx(NULL,hWnd,NULL,NULL)) 

GetWindowText(hWnd,name,200); 
len=strlen(name); 
ch[0]=name[len-2]; 
ch[1]=name[len-1];  if(strcmp(ch,"群\")==0 || strcmp(ch,"中\")==0 ) 

hFore=FindWindow(NULL,name);  
 
hParent=FindWindowEx(hFore,NULL,"#32770\",NULL);  
hChat=FindWindowEx(hParent,NULL,"AfxWnd42\",NULL);  
hChat=FindWindowEx(hParent,hChat,"AfxWnd42\",NULL);  
hChat=FindWindowEx(hChat,NULL,"RichEdit20A\",NULL);  
if( hChat ) 

SendMessage( hChat ,EM_REPLACESEL,0,LPARAM(szTest)); 
SendMessage(hParent,WM_COMMAND,id_Send,BN_CLICKED); 



}
vc6编译错误:
Compiling...
初级cpp.cpp
d:\常用软件\vc6.0_完整绿色版\vc98\include\tlhelp32.h(26) : error C2146: syntax error : missing ';' before identifier 'WINAPI'
d:\常用软件\vc6.0_完整绿色版\vc98\include\tlhelp32.h(26) : error C2501: 'HANDLE' : missing storage-class or type specifiers
d:\常用软件\vc6.0_完整绿色版\vc98\include\tlhelp32.h(26) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.初级cpp.obj - 1 error(s), 0 warning(s)
求解决办法!

解决方案 »

  1.   

    #include<windows.h>
    #include<tlhelp32.h>换个顺序
      

  2.   

    一般Win32程序,windows.h这个头文件要放在最前面。
      

  3.   

     错误提示啊,你用哪个版本的VS编译的??VS2003后要先建一个project才行
      

  4.   

    #include "stdafx.h"
    #include<windows.h>
    #include<tlhelp32.h>
    #include <time.h>HINSTANCE hInst;  
    HWND hWnd;/************** 程序ID定义 ******************/  #define id_Send 0x77E //发送按扭的ID  
    #define id_SendQQMsg 1001 //控制发送QQ消息的定时器ID  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)  
    {  
    HWND hFore, hChat, hParent;   

    char szTest[] = "这是我的QQ主页哦! http://user.qzone.qq.com/406960655";  
    HWND hWnd=NULL;  
    char name[200];  
    int len;  
    char ch[3] = {0, 0, 0};  
    while(hWnd=FindWindowEx(NULL,hWnd,NULL,NULL))  
    {  
    GetWindowText(hWnd,name,200);  
    len=strlen(name);  
    ch[0]=name[len-2];  
    ch[1]=name[len-1];  

    if(strcmp(ch,"群")==0 || strcmp(ch,"中")==0 )  
    {  
    hFore=FindWindow(NULL,name);   

    hParent=FindWindowEx(hFore,NULL,"#32770",NULL);   
    hChat=FindWindowEx(hParent,NULL,"AfxWnd42",NULL);   
    hChat=FindWindowEx(hParent,hChat,"AfxWnd42",NULL);   
    hChat=FindWindowEx(hChat,NULL,"RichEdit20A",NULL);   
    if( hChat )  
    {  
    SendMessage( hChat ,EM_REPLACESEL,0,LPARAM(szTest));  
    SendMessage(hParent,WM_COMMAND,id_Send,BN_CLICKED);  
    }  
    }  
    }  
    return 0;
    }
      

  5.   

    回复于:2012-04-30 22:26:16一般Win32程序,windows.h这个头文件要放在最前面。