// TODO: 在此添加控件通知处理程序代码
CString strKeyWord =_T("MSDN");
CString strGoogle = _T("http://www.google.com.hk/search?sourceid=chrome&ie=UTF-8&q=");
CString strBrowser=_T("C:\\Program Files\\Internet Explorer\\iexplore.exe");
//方法一:
//以默认浏览器搜索;
ShellExecute(GetSafeHwnd(),_T("open"),strGoogle+strKeyWord,NULL,NULL,SW_SHOWNORMAL);
//以指定的浏览器搜索;
ShellExecute(GetSafeHwnd(),_T("open"),strBrowser,strGoogle+strKeyWord,NULL,SW_SHOWNORMAL);
//方法二:
STARTUPINFO si={0};
si.cb=sizeof(STARTUPINFO);
si.wShowWindow = SW_SHOWNORMAL;
PROCESS_INFORMATION pi={0};
CString strSite =strBrowser+_T(" ")+strGoogle+strKeyWord;
CreateProcess(NULL,strSite.GetBuffer(strSite.GetLength()),NULL,NULL,FALSE,CREATE_DEFAULT_ERROR_MODE,
NULL,NULL,&si,&pi);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
CString strKeyWord =_T("MSDN");
CString strGoogle = _T("http://www.google.com.hk/search?sourceid=chrome&ie=UTF-8&q=");
CString strBrowser=_T("C:\\Program Files\\Internet Explorer\\iexplore.exe");
//方法一:
//以默认浏览器搜索;
ShellExecute(GetSafeHwnd(),_T("open"),strGoogle+strKeyWord,NULL,NULL,SW_SHOWNORMAL);
//以指定的浏览器搜索;
ShellExecute(GetSafeHwnd(),_T("open"),strBrowser,strGoogle+strKeyWord,NULL,SW_SHOWNORMAL);
//方法二:
STARTUPINFO si={0};
si.cb=sizeof(STARTUPINFO);
si.wShowWindow = SW_SHOWNORMAL;
PROCESS_INFORMATION pi={0};
CString strSite =strBrowser+_T(" ")+strGoogle+strKeyWord;
CreateProcess(NULL,strSite.GetBuffer(strSite.GetLength()),NULL,NULL,FALSE,CREATE_DEFAULT_ERROR_MODE,
NULL,NULL,&si,&pi);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);