2 apprentices apprentices 于 2016.03.12 20:43 提问

我想实现把粘贴板上的消息发给好友,然后关闭对话框,求大神帮忙

// PostMsgDemo.cpp: 定义控制台应用程序的入口点
//

#include"stdafx.h"
#include
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM param)
{

char strClassName[MAXBYTE] = { 0 };
GetClassNameA(hWnd, strClassName, MAXBYTE);
if (strcmp(strClassName, "TXGuiFoundation") == 0)

{
    ::PostMessageW(hWnd, WM_PASTE, 0, 0);
    ::PostMessageW(hWnd, WM_KEYDOWN, VK_RETURN, 0);

}
return true;//一定要return true

}
int _tmain(int argc, _TCHAR * argv[])
{

    HWND hQQMain = FindWindowA("TXGuiFoundation", "QQ");
    ShowWindow(hQQMain, SW_SHOW);
   for (int nIndex=0; nIndex <= 10; nIndex++)
    {

    ::SendMessageA(hQQMain, WM_KEYDOWN, VK_DOWN, 0);
    ::SendMessageA(hQQMain, WM_KEYDOWN, VK_RETURN, 0);
     EnumWindows(EnumWindowsProc, NULL);
    ::SendMessageA(hQQMain, WM_CLOSE,0 ,0);
     }

return 0;

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!