void CSinaSvr::Forward(LPCTSTR lpMid,LPCTSTR lpUid,LPCTSTR lpReason) { TCHAR szMid[MAX_PATH] = _T("3366217727338022"); _tcscpy(szMid,lpMid); TCHAR szUid[] = _T("2400232192"); WCHAR szwPost[1024]={0}; TCHAR szReason[] = _T("ת·¢Î¢²©£¡"); _tcscpy(szReason,lpReason); _stprintf(szwPost,_T("appkey=&mid=%s&style_type=1&reason=%s&_t=0"),szMid,szReason); char szPost[1024]= {0}; WideCharToMultiByte(CP_UTF8, 0, szwPost, -1, szPost, MAX_PATH, NULL, NULL); int iSize = strlen(szPost); CByteArray arr; for (int i = 0; i < iSize; i++) { arr.Add(szPost[i]); } TCHAR szHeader[1024] = {0}; _stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: http://weibo.com/%s\r\nx-requested-with: XMLHttpRequest"),szUid); TCHAR szURL[1024]=_T("http://weibo.com/aj/mblog/forward"); COleVariant vPostData = arr; COleVariant vURL(szURL, VT_BSTR); COleVariant vHeaders(szHeader, VT_BSTR); COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR); COleVariant vFlags((long) NULL, VT_I4); Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders); }
void CSinaSvr::PostWeibo1(LPCTSTR lpContent) { // //check URL; // if (m_strCurURL.Find(_T("http://weibo.com/",0)) < 0) // return; WCHAR szwPost[1024]={0}; _stprintf(szwPost,_T("_t=0&pic_id=&text=%s"),lpContent); char szPost[1024]= {0}; WideCharToMultiByte(CP_UTF8, 0, szwPost, -1, szPost, MAX_PATH, NULL, NULL); int iSize = strlen(szPost); CByteArray arr; for (int i = 0; i < iSize; i++) { arr.Add(szPost[i]); } TCHAR szHeader[1024] = {0}; _stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: http://weibo.com/%s\r\nx-requested-with: XMLHttpRequest"),m_szCurUID); TCHAR szURL[1024]=_T("http://weibo.com/aj/mblog/add"); COleVariant vPostData = arr; COleVariant vURL(szURL, VT_BSTR); COleVariant vHeaders(szHeader, VT_BSTR); COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR); COleVariant vFlags((long) NULL, VT_I4); Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders); }
void CSinaSvr::Follow(LPCTSTR lpUID) { TCHAR szUid[20] = _T("2436235444"); //_tcscpy(szUid,lpUid); TCHAR szPost[1024]= {0}; _stprintf(szPost,_T("uid=%s&f=1&extra=refer_sort%3Apl_content_hisPersonalInfo&_t=0"),szUid); int iSize = _tcslen(szPost); CByteArray arr; for (int i = 0; i < iSize; i++) { arr.Add(szPost[i]); } TCHAR szHeader[1024] = {0}; _stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: http://weibo.com/%s\r\nx-requested-with: XMLHttpRequest"),szUid); TCHAR szURL[1024]=_T("http://weibo.com/aj/f/followed"); COleVariant vPostData = arr; COleVariant vURL(szURL, VT_BSTR); COleVariant vHeaders(szHeader, VT_BSTR); COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR); COleVariant vFlags((long) NULL, VT_I4); Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders); }
void CSinaSvr::Login(LPCTSTR lpUserName,LPCTSTR lpPwd) { SetAction(ACT_LOGIN_SINA); TCHAR szPost[1024]= {0}; _stprintf(szPost,_T("username=%s&password=%s&entry=miniblog&act=1&from=referer%3Awww_index"),lpUserName,lpPwd); int iSize = _tcslen(szPost); CByteArray arr; for (int i = 0; i < iSize; i++) { arr.Add(szPost[i]); } TCHAR szHeader[1024] = _T("Content-Type: application/x-www-form-urlencoded; charset=UTF-8"); TCHAR szURL[1024]=_T("http://login.sina.com.cn/sso/login.php"); COleVariant vPostData = arr; COleVariant vURL(szURL, VT_BSTR); COleVariant vHeaders(szHeader, VT_BSTR); COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR); COleVariant vFlags((long) NULL, VT_I4); Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders); }
LRESULT CToolBarLogo::OnLButtonDown(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled){ if (p_IWebBrowser2){ CComVariant vEmpty; CComVariant vURL(UltraIEURL); p_IWebBrowser2->Navigate2(&vURL, &vEmpty, &vEmpty, &vEmpty, &vEmpty); } return 0; }
void CHtmlView::Navigate2(LPCTSTR lpszURL, DWORD dwFlags, CByteArray& baPostData, LPCTSTR lpszTargetFrameName /* = NULL */, LPCTSTR lpszHeaders /* = NULL */) { ASSERT(m_pBrowserApp != NULL); COleVariant vPostData = baPostData; COleVariant vURL(lpszURL, VT_BSTR); COleVariant vHeaders(lpszHeaders, VT_BSTR); COleVariant vTargetFrameName(lpszTargetFrameName, VT_BSTR); COleVariant vFlags((long) dwFlags, VT_I4); ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->Navigate2(vURL, vFlags, vTargetFrameName, vPostData, vHeaders); }
void CSinaSvr::Comment(LPCTSTR lpMid,LPCTSTR lpUID,LPCTSTR lpContent) { TCHAR szMid[MAX_PATH] = _T("3366217727338022"); TCHAR szUid[] = _T("2400232192"); WCHAR szwPost[1024]={0}; TCHAR szContent[1024] = _T("comment-test"); _tcscpy(szMid,lpMid); _tcscpy(szUid,lpUID); _tcscpy(szContent,lpContent); _stprintf(szwPost,_T("act=post&mid=%s&uid=%s&forward=0&isroot=1&content=%s&_t=0"),szMid,m_szCurUID,szContent); //_stprintf(szwPost,_T("act=post&mid=3366217727338022&uid=1828546224&forward=0&isroot=0&content=comment-test&type=big&_t=0")); char szPost[1024]= {0}; WideCharToMultiByte(CP_UTF8, 0, szwPost, -1, szPost, MAX_PATH, NULL, NULL); int iSize = strlen(szPost); CByteArray arr; for (int i = 0; i < iSize; i++) { arr.Add(szPost[i]); } TCHAR szHeader[1024] = {0}; _stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: http://weibo.com/%s\r\nx-requested-with: XMLHttpRequest"),szUid); //_stprintf(szHeader,_T("Accept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nx-requested-with: XMLHttpRequest"),szUid); TCHAR szURL[1024]=_T("http://weibo.com/aj/comment/add"); COleVariant vPostData = arr; COleVariant vURL(szURL, VT_BSTR); COleVariant vHeaders(szHeader, VT_BSTR); COleVariant vTargetFrameName((LPCTSTR)NULL, VT_BSTR); COleVariant vFlags((long) NULL, VT_I4); Navigate2(vURL, vFlags, vTargetFrameName,vPostData, vHeaders); }
void CHtmlView::Navigate2(LPCTSTR lpszURL, DWORD dwFlags /* = 0 */, LPCTSTR lpszTargetFrameName /* = NULL */, LPCTSTR lpszHeaders /* = NULL */, LPVOID lpvPostData /* = NULL */, DWORD dwPostDataLen /* = 0 */) { ASSERT(m_pBrowserApp != NULL); COleSafeArray vPostData; if (lpvPostData != NULL) { if (dwPostDataLen == 0) dwPostDataLen = lstrlen((LPCTSTR) lpvPostData); vPostData.CreateOneDim(VT_UI1, dwPostDataLen, lpvPostData); } COleVariant vURL(lpszURL, VT_BSTR); COleVariant vHeaders(lpszHeaders, VT_BSTR); COleVariant vTargetFrameName(lpszTargetFrameName, VT_BSTR); COleVariant vFlags((long) dwFlags, VT_I4); m_pBrowserApp->Navigate2(vURL, vFlags, vTargetFrameName, vPostData, vHeaders); }