Exemple #1
0
UINT CMessageSender::ExecuteSendMsg()
{
    Sleep(1000);

    // 添加为好友的提示框,有些用户要求必须添加为好友
    HWND hMustAddFriend = ::FindWindow("#32770", "添加好友信息");
    if (hMustAddFriend)
    {
        ::PostMessage(hMustAddFriend, WM_CLOSE, 0, 0);
    }
    else
    {
        SendOneMsg();
    }

    CString szIndex;
    szIndex.Format("%d", message.nItemIndex);
    ::PostMessage(this->m_hMainWnd, WM_SENDMSG_COMPLETED, (WPARAM)0, (LPARAM)szIndex.GetBuffer());

    // 验证码不对,则直接关掉
    HWND hValidCodeWnd = FindTopWindowExactly("阿里旺旺 - 安全验证", "#32770");
    if (hValidCodeWnd)
    {
        ::PostMessage(hValidCodeWnd, WM_CLOSE, 0, 0);
    }

    return 0;
}
int TcpTransport::SendData(const char* pBuffer, size_t len,int timeOut)
{
	kpr::ScopedLock<kpr::Mutex> lock(m_sendLock);
	return SendOneMsg(pBuffer,len,timeOut);
}