当前位置: 首页>>代码示例>>C++>>正文


C++ CComboBox::GetWindowTextLength方法代码示例

本文整理汇总了C++中CComboBox::GetWindowTextLength方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::GetWindowTextLength方法的具体用法?C++ CComboBox::GetWindowTextLength怎么用?C++ CComboBox::GetWindowTextLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CComboBox的用法示例。


在下文中一共展示了CComboBox::GetWindowTextLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetFindText

int FindReplDlg::GetFindText(CComboBox& wnd, bsString& text)
{
	int len;
	char *tp;
	int sel = wnd.GetCurSel();
	if (sel == -1)
	{
		len = wnd.GetWindowTextLength()+1;
		tp = new char[len];
		wnd.GetWindowText(tp, len);
		sel = wnd.FindStringExact(-1, tp);
		if (sel == -1)
		{
			sel = wnd.InsertString(0, tp);
			wnd.SetCurSel(sel);
		}
		int cnt;
		while ((cnt = wnd.GetCount()) >= 20)
			wnd.DeleteString(cnt-1);
	}
	else
	{
		len = wnd.GetLBTextLen(sel)+1;
		tp = new char[len];
		wnd.GetLBText(sel, tp);
	}
	text.Attach(tp);
	return sel;
}
开发者ID:travisgoodspeed,项目名称:basicsynth,代码行数:29,代码来源:FindReplDlg.cpp

示例2: OnCloseCmd

LRESULT FavHubProperties::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	if(wID == IDOK)
	{
		TCHAR buf[1024];
		GetDlgItemText(IDC_HUBADDR, buf, 256);
		if(buf[0] == '\0') {
			WinUtil::showMessageBox(TSTRING(INCOMPLETE_FAV_HUB), MB_ICONWARNING);
			return 0;
		}

		//check the primary address for dupes
		string addresses = Text::fromT(buf);
		size_t pos = addresses.find(";");

		if (!FavoriteManager::getInstance()->isUnique(pos != string::npos ? addresses.substr(0, pos) : addresses, entry->getToken())){
			WinUtil::showMessageBox(TSTRING(FAVORITE_HUB_ALREADY_EXISTS), MB_ICONWARNING);
			return 0;
		}

		//validate the encoding
		GetDlgItemText(IDC_ENCODING, buf, 512);
		if(_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && _tcscmp(buf, _T("System default")) != 0)
		{
			WinUtil::showMessageBox(TSTRING(INVALID_ENCODING), MB_ICONWARNING);
			return 0;
		}

		//set the values
		entry->setEncoding(Text::fromT(buf));
		entry->setServerStr(addresses);

		GetDlgItemText(IDC_HUBNAME, buf, 256);
		entry->setName(Text::fromT(buf));
		GetDlgItemText(IDC_HUBDESCR, buf, 256);
		entry->setDescription(Text::fromT(buf));
		GetDlgItemText(IDC_HUBPASS, buf, 256);
		entry->setPassword(Text::fromT(buf));
		entry->setStealth(IsDlgButtonChecked(IDC_STEALTH) == 1);
		entry->setFavNoPM(IsDlgButtonChecked(IDC_FAV_NO_PM) == 1);

		//Hub settings
		GetDlgItemText(IDC_NICK, buf, 256);
		entry->get(HubSettings::Nick) = Text::fromT(buf);

		GetDlgItemText(IDC_USERDESC, buf, 256);
		entry->get(HubSettings::Description) = Text::fromT(buf);

		GetDlgItemText(IDC_EMAIL, buf, 256);
		entry->get(HubSettings::Email) = Text::fromT(buf);

		GetDlgItemText(IDC_AWAY_MSG, buf, 1024);
		entry->get(HubSettings::AwayMsg) = Text::fromT(buf);

		entry->get(HubSettings::ShowJoins) = to3bool(IsDlgButtonChecked(IDC_SHOW_JOIN));
		entry->get(HubSettings::FavShowJoins) = to3bool(IsDlgButtonChecked(IDC_SHOW_JOIN));
		entry->get(HubSettings::LogMainChat) = to3bool(IsDlgButtonChecked(IDC_LOGMAINCHAT));
		entry->get(HubSettings::ChatNotify) = to3bool(IsDlgButtonChecked(IDC_CHAT_NOTIFY));
		entry->get(HubSettings::AcceptFailovers) = to3bool(IsDlgButtonChecked(IDC_FAILOVER));

		auto val = HubSettings::getMinInt();
		if (!IsDlgButtonChecked(IDC_SEARCH_INTERVAL_DEFAULT)) {
			GetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, buf, 512);
			val = Util::toInt(Text::fromT(buf));
		}
		entry->get(HubSettings::SearchInterval) = val;

		
		CComboBox combo;
		combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));
	
		if(combo.GetCurSel() == 0)
		{
			entry->setGroup(Util::emptyString);
		}
		else
		{
			tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
			combo.GetWindowText(&text[0], text.size());
			text.resize(text.size()-1);
			entry->setGroup(Text::fromT(text));
		}
		combo.Detach();


		// connection modes
		auto getConnMode = [](const CComboBox& combo) -> int {
			 if (combo.GetCurSel() == 1)
				return SettingsManager::INCOMING_DISABLED;
			else if (combo.GetCurSel() == 2)
				return SettingsManager::INCOMING_ACTIVE;
			else if (combo.GetCurSel() == 3)
				return SettingsManager::INCOMING_PASSIVE;

			return HubSettings::getMinInt();
		};

		entry->get(HubSettings::Connection) = getConnMode(modeCombo4);
		entry->get(HubSettings::Connection6) = getConnMode(modeCombo6);

//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:airdc-svn,代码行数:101,代码来源:FavHubProperties.cpp

示例3: OnCloseCmd

LRESULT FavHubProperties::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	if(wID == IDOK)
	{
		TCHAR buf[512];
		GetDlgItemText(IDC_HUBADDR, buf, 256);
		if(buf[0] == '\0') {
			MessageBox(CTSTRING(INCOMPLETE_FAV_HUB), _T(""), MB_ICONWARNING | MB_OK);
			return 0;
		}
		entry->setServer(Text::fromT(buf));
		GetDlgItemText(IDC_HUBNAME, buf, 256);
		entry->setName(Text::fromT(buf));
		GetDlgItemText(IDC_HUBDESCR, buf, 256);
		entry->setDescription(Text::fromT(buf));
		GetDlgItemText(IDC_HUBNICK, buf, 256);
		entry->setNick(Text::fromT(buf));
		GetDlgItemText(IDC_HUBPASS, buf, 256);
		entry->setPassword(Text::fromT(buf));
		GetDlgItemText(IDC_HUBUSERDESCR, buf, 256);
		entry->setUserDescription(Text::fromT(buf));
		entry->setStealth(IsDlgButtonChecked(IDC_STEALTH) == 1);
		GetDlgItemText(IDC_RAW_ONE, buf, 512);
		entry->setRawOne(Text::fromT(buf));
		GetDlgItemText(IDC_RAW_TWO, buf, 512);
		entry->setRawTwo(Text::fromT(buf));
		GetDlgItemText(IDC_RAW_THREE, buf, 512);
		entry->setRawThree(Text::fromT(buf));
		GetDlgItemText(IDC_RAW_FOUR, buf, 512);
		entry->setRawFour(Text::fromT(buf));
		GetDlgItemText(IDC_RAW_FIVE, buf, 512);
		entry->setRawFive(Text::fromT(buf));
		GetDlgItemText(IDC_SERVER, buf, 512);
		entry->setIP(Text::fromT(buf));
		GetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, buf, 512);
		entry->setSearchInterval(Util::toUInt32(Text::fromT(buf)));
		
		GetDlgItemText(IDC_ENCODING, buf, 512);
		if(_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && _tcscmp(buf, _T("System default")) != 0)
		{
			MessageBox(_T("Invalid encoding!"), _T(""), MB_ICONWARNING | MB_OK);
			return 0;
		}
		entry->setEncoding(Text::fromT(buf));
		
		CComboBox combo;
		combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));
	
		if(combo.GetCurSel() == 0)
		{
			entry->setGroup(Util::emptyString);
		}
		else
		{
			tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
			combo.GetWindowText(&text[0], text.size());
			text.resize(text.size()-1);
			entry->setGroup(Text::fromT(text));
		}
		combo.Detach();

		int	ct = -1;
		if(IsDlgButtonChecked(IDC_DEFAULT))
			ct = 0;
		else if(IsDlgButtonChecked(IDC_ACTIVE))
			ct = 1;
		else if(IsDlgButtonChecked(IDC_PASSIVE))
			ct = 2;

		entry->setMode(ct);

		FavoriteManager::getInstance()->save();
	}
	EndDialog(wID);
	return 0;
}
开发者ID:strogo,项目名称:StrongDC,代码行数:76,代码来源:FavHubProperties.cpp

示例4: write

bool FavHubGeneralPage::write() {
	TCHAR buf[1024];
	GetDlgItemText(IDC_HUBADDR, buf, 256);
	if (buf[0] == '\0') {
		WinUtil::showMessageBox(TSTRING(INCOMPLETE_FAV_HUB), MB_ICONWARNING);
		return false;
	}

	//check the primary address for dupes
	string addresses = Text::fromT(buf);
	size_t pos = addresses.find(";");

	if (!FavoriteManager::getInstance()->isUnique(pos != string::npos ? addresses.substr(0, pos) : addresses, entry->getToken())) {
		WinUtil::showMessageBox(TSTRING(FAVORITE_HUB_ALREADY_EXISTS), MB_ICONWARNING);
		return false;
	}

	//validate the encoding
	GetDlgItemText(IDC_ENCODING, buf, 512);
	if (_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && ctrlEncoding.GetCurSel() != 0)
	{
		WinUtil::showMessageBox(TSTRING_F(INVALID_ENCODING, buf), MB_ICONWARNING);
		return false;
	}

	//set the values
	entry->get(HubSettings::NmdcEncoding) = ctrlEncoding.GetCurSel() != 0 ? Text::fromT(buf) : Util::emptyString;
	entry->setServer(addresses);

	GetDlgItemText(IDC_HUBNAME, buf, 256);
	entry->setName(Text::fromT(buf));
	GetDlgItemText(IDC_HUBDESCR, buf, 256);
	entry->setDescription(Text::fromT(buf));
	GetDlgItemText(IDC_HUBPASS, buf, 256);
	entry->setPassword(Text::fromT(buf));

	//Hub settings
	GetDlgItemText(IDC_NICK, buf, 256);
	entry->get(HubSettings::Nick) = Text::fromT(buf);

	GetDlgItemText(IDC_USERDESC, buf, 256);
	entry->get(HubSettings::Description) = Text::fromT(buf);

	GetDlgItemText(IDC_EMAIL, buf, 256);
	entry->get(HubSettings::Email) = Text::fromT(buf);

	CComboBox combo;
	combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));

	if (combo.GetCurSel() == 0)
	{
		entry->setGroup(Util::emptyString);
	}
	else
	{
		tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
		combo.GetWindowText(&text[0], text.size());
		text.resize(text.size() - 1);
		entry->setGroup(Text::fromT(text));
	}
	combo.Detach();

	auto p = ShareManager::getInstance()->getProfiles();

	ProfileToken token = HUB_SETTING_DEFAULT_INT;
	if (hideShare) {
		token = SP_HIDDEN;
	}
	else if (entry->isAdcHub() && ctrlProfile.GetCurSel() != 0) {
		token = p[ctrlProfile.GetCurSel() - 1]->getToken();
	}

	entry->get(HubSettings::ShareProfile) = token;

	//FavoriteManager::getInstance()->save();

	return true;
}
开发者ID:,项目名称:,代码行数:78,代码来源:


注:本文中的CComboBox::GetWindowTextLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。