Replace 函数的使用
m_strUrl.Replace("#","%23");m_strUrl.Replace("++", "%2B%2B");
注释说 这两句解决c# 和 c++搜索时的错误,但是不知道这函数到底怎么来实现?
摘自:
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CDsearchDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CDsearchDlg::OnSearchbtn()
{
// TODO: Add your control notification handler code here
CString strBaidu, strGoogle;
GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_EDIT2)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_EDIT1)->GetWindowText(m_strUrl);
m_bHomePage = TRUE;
GetDlgItem(IDC_EDIT2)->SetWindowText("");
GetDlgItem(IDC_HPBTN)->SetWindowText("HomePage");
m_wHomePage.Navigate("http://alantop.5166.info/zhmster/index.htm",NULL,NULL,NULL,NULL);
if(!m_bFlag)
{
::ShowWindow( m_IE2.GetSafeHwnd(), SW_SHOW );
::ShowWindow( m_WebBrowser2.GetSafeHwnd(), SW_SHOW );
::ShowWindow( m_wHomePage.GetSafeHwnd(), SW_HIDE );
m_bFlag = TRUE;
return;
}
//这两句解决c# 和 c++搜索时的错误
m_strUrl.Replace("#","%23");
m_strUrl.Replace("++", "%2B%2B");
strBaidu = "http://www.baidu.com/s?pn=0&wd=" + m_strUrl + "&cl=3&rn=";
strGoogle = "http://www. + m_strUrl+ "&start=0&num=";
m_WebBrowser2.Navigate(strGoogle,NULL,NULL,NULL,NULL);
m_IE2.Navigate(strBaidu,NULL,NULL,NULL,NULL);
}