bool SnarlInterface::snUpdateMessage(long id, std::wstring title, 
	std::wstring text, std::wstring icon)
{
	SNARLSTRUCT snarlStruct;
	snarlStruct.id = id;
	snarlStruct.cmd = SNARL_UPDATE;

	int len;
	char* buf = convertToMultiByte(title, &len);
	strncpy(snarlStruct.title, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.title[len] = 0;
	delete[] buf;

	buf = convertToMultiByte(text, &len);
	strncpy(snarlStruct.text, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.text[len] = 0;
	delete[] buf;

	buf = convertToMultiByte(icon, &len);
	strncpy(snarlStruct.icon, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.icon[len] = 0;
	delete[] buf;

	return static_cast<bool>(send(snarlStruct));
}
long SnarlInterface::snShowMessageEx(std::wstring title, std::wstring text,
	long timeout, std::wstring iconPath, HWND hWndReply, long uReplyMsg,
	std::wstring soundPath, std::wstring msgClass)
{
	SNARLSTRUCTEX snarlStruct;
	snarlStruct.cmd = SNARL_EX_SHOW;

	int len;
	char* buf = convertToMultiByte(title, &len);
	strncpy(snarlStruct.title, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.title[len] = 0;
	delete[] buf;

	buf = convertToMultiByte(text, &len);
	strncpy(snarlStruct.text, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.text[len] = 0;
	delete[] buf;

	buf = convertToMultiByte(iconPath, &len);
	strncpy(snarlStruct.icon, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.icon[len] = 0;
	delete[] buf;

	buf = convertToMultiByte(msgClass, &len);
	strncpy(snarlStruct.snarlClass, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.snarlClass[len] = 0;
	delete[] buf;

	snarlStruct.timeout = timeout;
	snarlStruct.lngData2 = reinterpret_cast<long>(hWndReply);
	snarlStruct.id = uReplyMsg;
	return send(snarlStruct);
}
Пример #3
0
void DlgHandlerImpl::setDescriptionText( HWND hwnd )
{

//	char string[ 255 ] = { 0 };
//	SendMessageW( hwnd, WM_GETTEXT, (WPARAM)255, (LPARAM)string );
//	std::string current_text = ::game::getLocaleGuiString( string );

	wchar_t string_w[ 255 ] = { 0 };
	SendMessageW( hwnd, WM_GETTEXT, (WPARAM)255, (LPARAM)string_w );

	std::string string;
	convertToMultiByte( string_w, string );
	std::string current_text = ::game::getLocaleGuiString( string.c_str() );

	//std::string current_text = string;
//	if( ::game::DHLocaleManager::getInstance()->hasString( ::game::DHLocaleManager::BANK_GUI, string ) == false )
//		return;

//#ifdef FB_RU_HAX
//	std::wstring uni_text = ::game::DHLocaleManager::getInstance()->getWideString(::game::DHLocaleManager::BANK_GUI, string);
	std::wstring uni_text;
	convertToWide( current_text, uni_text );
//	const wchar_t *ptr = uni_text.c_str();
	SendMessageW( hwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)uni_text.c_str() );
/*#else
	SendMessage( hwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCTSTR)current_text.c_str() );
	// WB_SETSTRING
#endif*/

}
bool SnarlInterface::snRegisterAlert(std::wstring appName, std::wstring alertName)
{
	SNARLSTRUCT snarlStruct;
	snarlStruct.cmd = SNARL_REGISTER_ALERT;

	int len;
	char* buf = convertToMultiByte(appName, &len);
	strncpy(snarlStruct.title, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.title[len] = 0;
	delete[] buf;

	buf = convertToMultiByte(alertName, &len);
	strncpy(snarlStruct.text, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.text[len] = 0;
	delete[] buf;

	return static_cast<bool>(send(snarlStruct));
}
Пример #5
0
string createLocaleDirectory(wstring subDirectory)
// create a directory in the language of the current locale
// the locale must be set before calling this function
{
	string subdir = convertToMultiByte(subDirectory);
	string dirpath  = getTestDirectory() + subdir;
	standardizePath(subdir);
	// create directory
	createTestDirectory(dirpath);
	return subdir;
}
bool SnarlInterface::snRegisterConfig2(HWND hWnd, std::wstring appName,
	long replyMsg, std::wstring icon)
{
	SNARLSTRUCT snarlStruct;

	snarlStruct.cmd = SNARL_REGISTER_CONFIG_WINDOW_2;
	snarlStruct.lngData2 = reinterpret_cast<long>(hWnd);
	snarlStruct.id = replyMsg;

	int len;
	char* buf = convertToMultiByte(appName, &len);
	strncpy(snarlStruct.title, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.title[len] = 0;
	delete[] buf;

	buf = convertToMultiByte(icon, &len);
	strncpy(snarlStruct.icon, buf, SNARL_STRING_LENGTH - 1);
	snarlStruct.icon[len] = 0;
	delete[] buf;

	return static_cast<bool>(send(snarlStruct));
}
Пример #7
0
string &Translation::translate(const string &stringIn) const
// Translate a string.
// Return a static string instead of a member variable so the method can have a "const" designation.
// This allows "settext" to be called from a "const" method.
{
	static string mbTranslation;
	mbTranslation.clear();
	for (size_t i = 0; i < m_translation.size(); i++)
	{
		if (m_translation[i].first == stringIn)
		{
			mbTranslation = convertToMultiByte(m_translation[i].second);
			break;
		}
	}
	// not found, return english
	if (mbTranslation.empty())
		mbTranslation = stringIn;
	return mbTranslation;
}