Exemplo n.º 1
0
void CSearchBox::Search()
{
	CString url, keyword;
	GetWindowText(keyword);
	CString originalKeyword = keyword;

	CStringA encodedKeyword;
	CURLEncode x;
	USES_CONVERSION;
	encodedKeyword = x.URLEncode(keyword);
	keyword = A2W(encodedKeyword);

	// CAdsManager::GetInstance()->GetAds(originalKeyword);		// call CAdsManager to show ads
	CAdsManager::GetInstance()->SendSearchKeyword(keyword);

	CString dummy;
	CSearchManager::GetInstance()->GetDefaultEngine(dummy, url);


	url.Replace(_T("{[%s]}"), keyword);
	if (thePrefs.GetDefaultBrowserName() == _T("IE"))
	{
		ShellExecute(NULL, _T("open"), _T("IEXPLORE"), url, 
			NULL, SW_SHOW); 
	}
	else
	{
		ShellExecute(NULL, _T("open"), url, 
			NULL, _T(""), SW_SHOW); 
	}
}
Exemplo n.º 2
0
char*
CHttp::GetEncodedData(const char * data, char * outdata, DWORD * encodeddatalen )
{
	char		*encodereq		= outdata;
	DWORD		encodedlen = 0;
	CURLEncode	encode;

	if (!encode.URLEncode(data, encodereq, &encodedlen ) )
		goto cleanup;
	
	if (encodeddatalen ) *encodeddatalen = encodedlen;

	return outdata;

cleanup:

	return NULL;
}
Exemplo n.º 3
0
char*
CHttp::GetEncodedData (char * data, DWORD * encodeddatalen )
{
	*encodeddatalen = 0;

	DWORD		datalen = (strlen (data ) * 3) + 1;
	char		*encodereq = (char*) malloc (sizeof (char ) * datalen ); 

	CURLEncode	encode;

	if (!encode.URLEncode(data, encodereq, encodeddatalen ) )
		goto cleanup;

	return encodereq;

cleanup:

	free (encodereq );
	
	return NULL;
}