void CTextView::Update() { CString strTemp1,strTemp2 = ::GetPropertyCtrl()->GetTextSource(); CTextColumnSet TCS; if((strTemp2 == _T("Heyboer")) || (strTemp2 == _T("Harvard Yenching")) || (strTemp2 == _T("YellowBridge")) || (strTemp2 == _T("Stackhouse"))) { strTemp1.Format(_T("select V%d from Text6 where Type = 'Text' and Name = '%s'"), ::GetApp()->GetCurrentHexagram()->GetValue(),strTemp2); if(TCS.OpenRowset(::GetApp()->GetBeliefBase(),strTemp1)) Navigate2(TCS.m_szText,NULL,NULL); } else Navigate2(_T("file:///") + ::ReplaceString(::ConcatPaths(::GetProgramFolder(),_T("Html"),_T("Hexagram.html"),NULL), _T("%20"),_T(" ")) + _T("?Name=") + ::GetApp()->GetCurrentHexagram()->GetLabel(),NULL,NULL); }
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 CMfcieView::OnHelpMicrosoftOnTheWebMicrosoftHomePage() { CString str; str.LoadString(IDS_MICROSOFT_HOME_PAGE); Navigate2(str, 0, NULL); }
void CMfcieView::OnHelpMicrosoftOnTheWebInternetStartPage() { CString str; str.LoadString(IDS_INTERNET_START_PAGE); Navigate2(str, 0, NULL); }
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 CMfcieView::OnHelpMicrosoftOnTheWebBestOfTheWeb() { CString str; str.LoadString(IDS_BEST_OF_THE_WEB); Navigate2(str, 0, NULL); }
void CMfcieView::OnHelpMicrosoftOnTheWebFrequentlyAskedQuestions() { CString str; str.LoadString(IDS_FREQUENTLY_ASKED_QUESTIONS); Navigate2(str, 0, NULL); }
void CMfcieView::OnHelpMicrosoftOnTheWebGetFasterInternetAccess() { CString str; str.LoadString(IDS_GET_FASTER_INTERNET_ACCESS); Navigate2(str, 0, NULL); }
// these all go to specific web pages, just like Internet Explorer's help menu void CMfcieView::OnHelpWebTutorial() { CString str; str.LoadString(IDS_WEB_TUTORIAL); Navigate2(str, 0, NULL); }
void CMfcieView::OnHelpMicrosoftOnTheWebFreeStuff() { CString str; str.LoadString(IDS_FREE_STUFF); Navigate2(str, 0, NULL); }
void CMfcieView::OnHelpOnlineSupport() { CString str; str.LoadString(IDS_ONLINE_SUPPORT); Navigate2(str, 0, NULL); }
void CMfcieView::OnHelpMicrosoftOnTheWebSearchTheWeb() { CString str; str.LoadString(IDS_SEARCH_THE_WEB); Navigate2(str, 0, NULL); }
void CMfcieView::OnHelpMicrosoftOnTheWebSendFeedback() { CString str; str.LoadString(IDS_SEND_FEEDBACK); Navigate2(str, 0, NULL); }
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); }
void CBCGPIE7DemoView::NavigateB(LPCTSTR lpszURL, DWORD dwFlags/* = 0*/, LPCTSTR lpszTargetFrameName/* = NULL*/, LPCTSTR lpszHeaders/* = NULL*/, LPVOID lpvPostData/* = NULL*/, DWORD dwPostDataLen/* = 0*/) { m_bTitleUpdated = FALSE; Navigate2 (lpszURL, dwFlags, lpszTargetFrameName, lpszHeaders, lpvPostData, dwPostDataLen); }
void CPackerCView::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); // TODO: This code navigates to a popular spot on the web. // change the code to go where you'd like. Navigate2(_T("about:PackerC"),NULL,NULL); }
void CWebView::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); // TODO: This code navigates to a popular spot on the web. // change the code to go where you'd like. Navigate2("www.imbc.com",NULL,NULL); }
void CShowpicView::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); // TODO: This code navigates to a popular spot on the web. // change the code to go where you'd like. Navigate2(_T("I:\\ÎâÓ\\ÎâÓÏà²á\\ͼƬ\\·ç¾°±ÚÖ½\\001.jpg"),NULL,NULL); }
/// DLコントロールの変更を有効にするために更新する void CDonutView::_LightRefresh() { if (::GetKeyState(VK_CONTROL) < 0) return; m_bLightRefresh = true; CString strURL = GetLocationURL(); Navigate2(strURL); }
void CHookCookieTestView::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); SetSilent(TRUE); //char *szURL = "http://192.168.50.165/portal/erm/portal/index"; char *szURL = "http://www.jd.com"; //char *szURL = "http://www.taobao.com/"; //char *szURL = "about:blank"; Navigate2(szURL,NULL,NULL); }
// This demonstrates how we can use the Navigate2() function to load local files // including local HTML pages, GIFs, AIFF files, etc. void CIEDemoView::OnFileOpen() { CString str; str.LoadString(IDS_FILETYPES); CFileDialog fileDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, str); if(fileDlg.DoModal() == IDOK) Navigate2(fileDlg.GetPathName(), 0, NULL); }
///////////////////////////////////////////////////////////////////////////// // CIEDemoView message handlers // these are all simple one-liners to do simple controlling of the browser void CIEDemoView::OnGoBack() { CIEDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CHistoryObj* pHistoryObj = pDoc->GoBack (); if (pHistoryObj != NULL) { Navigate2 (pHistoryObj->GetURL (), 0, NULL); } }
STDMETHODIMP CDonutView::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) { m_spDropTargetHelper->Drop(pDataObj, (LPPOINT)&pt, *pdwEffect); if (m_bDragAccept && m_bUseCustomDropTarget) { CSimpleArray<CString> arrFiles; if ( MtlGetDropFileName(pDataObj, arrFiles) ) { // ファイルがDropされた unsigned df = DonutGetStdOpenFlag(); unsigned size = arrFiles.GetSize(); //if (size == 1) // df |= D_OPENFILE_NOCREATE; for (unsigned i = 0; i < size; ++i) DonutOpenFile(m_hWnd, arrFiles[i], df); *pdwEffect = DROPEFFECT_COPY; } else { CString strText; if ( MtlGetHGlobalText(pDataObj, strText) || MtlGetHGlobalText(pDataObj, strText, CF_SHELLURLW) ) { ::SendMessage(GetTopLevelParent(), WM_COMMAND_DIRECT, m_nDDCommand, (LPARAM) (LPCTSTR) strText); *pdwEffect = DROPEFFECT_NONE; } } } else if (MTL::MtlIsDataAvailable(pDataObj, CF_SHELLURLW)) { // タブなどから CString strURL; MtlGetHGlobalText(pDataObj, strURL, CF_SHELLURLW); if (strURL.IsEmpty() == FALSE) { MTL::ParseInternetShortcutFile(strURL); // ファイルパス->URL Navigate2(strURL); } } else if (m_bExternalDrag) { // 外部から CString strURL; MtlGetHGlobalText(pDataObj, strURL, ::RegisterClipboardFormat(CFSTR_FILENAME)); if (strURL.IsEmpty() == FALSE) { MTL::ParseInternetShortcutFile(strURL); // ファイルパス->URL Navigate2(strURL); } } return S_OK; }
void CSTBBrowser2View::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); CSTBBrowser2Doc* pDoc = GetDocument(); // TODO: This code navigates to a popular spot on the web. // change the code to go where you'd like. CSTBBrowser2App *p=(CSTBBrowser2App *)::AfxGetApp(); char *command = p->GetCommandLine(); if(strncmp(command,"open-old-page",strlen("open-old-page"))==0 &&p->IsNetworkedTVMode()){ //open old page; char history[1024]; ReadPreviousURL(history,1024); if(strncmp("http://",history,strlen("http://"))==0){ Navigate2(history,NULL,NULL); }else{ Navigate2(command,NULL,NULL); } }else{ Navigate2(command,NULL,NULL); } }
void CChatView::NavigateMemory() { //get application name CString sAppName = AfxGetApp()->m_pszExeName; CString sResourseID; //get resourse ID of Empty Html sResourseID.Format(_T("%d"), IDR_EMPTY_HTML); CString sNavigatePath; //compile sNavigatePath=_T("res://")+sAppName+_T(".exe/")+sResourseID; Navigate2( sNavigatePath); //Activate memory mode m_bMemoryMode=TRUE; }
void CCHtmlViewDemoView::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); TCHAR szPath[255]; ::GetModuleFileName(NULL,szPath, sizeof(szPath) / sizeof(TCHAR)); CString path = szPath; int nIndex = path.ReverseFind(_T('\\')); ASSERT(nIndex != -1); path = path.Left(nIndex + 1) + _T("index.html"); Navigate2(path); //Navigate2(_T("http://www.baidu.com/"),NULL,NULL); }
void CMFCApplication2View::OnDocumentComplete(LPCTSTR lpszURL) { CHtmlView::OnDocumentComplete(lpszURL); if (lpszURL != nullptr) { CString strURL(lpszURL); static int i = 0; if (strURL.Find(_T("127.0.0.1.com/?code=")) > 0 && i == 0) { CString strCode = strURL.Mid(strURL.Find(_T("127.0.0.1.com/?code="))+20); CString strNewURL(_T("https://api.ciscospark.com/v1/access_token")); CString strPostData(_T("grant_type=authorization_code&client_id=Ce07a320a3e5fd132ac55854ef107e48988fb573b0478c4126df9f01d941a3ec3&client_secret=ec699f8e1f970a7b4e76b06ca226e1d5e3a5c40ee509cacbda2f6d1da7662b67&redirect_uri=http%3A%2F%2F127.0.0.1.com&code=")); strPostData.Append(strCode); Navigate2(strNewURL, NULL, NULL, NULL, (LPVOID)(LPCTSTR)strPostData, (DWORD)strPostData.GetLength()); i++; } if (i == 1) { LPDISPATCH lpDispatch; lpDispatch = GetHtmlDocument(); ASSERT(lpDispatch); CComQIPtr <IHTMLDocument2, &IID_IHTMLDocument2> pDoc2; HRESULT hr; hr = lpDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&pDoc2); if (SUCCEEDED(hr)) { IHTMLElement *pBodyElement; pDoc2->get_body(&pBodyElement); BSTR body; pBodyElement->get_innerHTML(&body); char * strBody = ::_com_util::ConvertBSTRToString(body); pDoc2.Release(); } lpDispatch->Release(); } } }
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 CMFCApplication2View::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); Navigate2(_T("https://api.ciscospark.com/v1/authorize?client_id=Ce07a320a3e5fd132ac55854ef107e48988fb573b0478c4126df9f01d941a3ec3&response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1.com&scope=spark%3Amessages_write%20spark%3Arooms_read%20spark%3Amemberships_read%20spark%3Amessages_read%20spark%3Arooms_write%20spark%3Apeople_read%20spark%3Amemberships_write&state=set_state_here"),NULL,NULL); }