本文整理汇总了C++中atl::CString::GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::GetBuffer方法的具体用法?C++ CString::GetBuffer怎么用?C++ CString::GetBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atl::CString
的用法示例。
在下文中一共展示了CString::GetBuffer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckIp
BOOL CSetProxServer::CheckIp( ATL::CString& str )//检查IP地址是否合法
{
LPCWSTR lpIpString = str.GetBuffer(-1);
str.ReleaseBuffer(-1);
int nStrLen = 0;
int nDotCount = 0;
nStrLen = wcslen(lpIpString);
if((nStrLen > 15) || (nStrLen < 7))
return FALSE;
for(int i=0; i < nStrLen; ++i)
{
if( lpIpString[i] == L'.' )
{
if( (lpIpString[i+1] == '.') || (i==0) || (i==nStrLen-1))
return FALSE;
nDotCount++;
continue;
}
if( (lpIpString[i] < L'0') || (lpIpString[i] > L'9') )
return FALSE;
}
if( nDotCount == 3)
{
if(inet_addr(CW2A(str.GetBuffer(-1))) != INADDR_NONE)
{
return TRUE;
}
}
return FALSE;
}
示例2: GetStringValue
ATL::CString GetStringValue(CRegKey& rk, const ATL::CString& valueName)
{
ATL::CString result;
DWORD dwLen = 1024;
rk.QueryStringValue(valueName, result.GetBuffer(dwLen), &dwLen);
result.ReleaseBuffer();
return result;
}
示例3: MakeFilterString
inline void MakeFilterString(ATL::CString& str)
{
char *pch = str.GetBuffer();
for(int i = 0; i < str.GetLength(); ++i)
if(pch[i] == '|') pch[i] = '\0';
}
示例4: doApplySetting
BOOL CSetProxServer::doApplySetting()
{
//写配置文件
CIniFile IniFile(m_strFilePath);
ATL::CString strHttp = L"";
int nType;
ATL::CString strVerify = L"";
int nVerify;
ATL::CString strAddr = L"";
ATL::CString strPort = L"";
int nPort;
ATL::CString strAccount = L"";
ATL::CString strPass = L"";
HRESULT hr;
EM_KXE_NETPROXY_TYPE emType;
int nIndex = m_ComBoHttp.GetCurSel();
if ( nIndex!= -1)
{
int n = m_ComBoHttp.GetLBTextLen( nIndex );
m_ComBoHttp.GetLBText( nIndex, strHttp.GetBuffer(n) );
strHttp.ReleaseBuffer();
}
nIndex = m_ComBoVerify.GetCurSel();
if (nIndex != -1)
{
int n = m_ComBoVerify.GetLBTextLen( nIndex );
m_ComBoVerify.GetLBText( nIndex, strVerify.GetBuffer(n) );
strVerify.ReleaseBuffer();
}
//获得地址
m_wndEditAddr.GetWindowText(strAddr);
//ip地址过滤
if ((strAddr == L"" || !CheckIp(strAddr)) && m_ComBoHttp.GetCurSel() != 0)
{
CBkSafeMsgBox2::ShowMultLine( L"IP地址为空或者不合法,请您重新输入!", L"金山卫士", MB_OK|MB_ICONWARNING);
return FALSE;
}
m_wndEditPort.GetWindowText(strPort);
//port检测
if (strPort == L"" && m_ComBoHttp.GetCurSel() != 0)
{
CBkSafeMsgBox2::ShowMultLine( L"端口设置不能为空,请您重新输入!", L"金山卫士", MB_OK|MB_ICONWARNING);
return FALSE;
}
m_wndEditAccount.GetWindowText(strAccount);
m_wndEditPass.GetWindowText(strPass);
nType = readInt(strHttp);
nVerify = readInt(strVerify);
if (strPort == L"")
nPort = -1;
else
nPort = _ttoi(strPort);
//判断验证情况下 用户名和密码是否为空
if (nVerify == 1)//需要验证的情况
{
if (strAccount == L"" || strPass == L"")
{
CBkSafeMsgBox2::ShowMultLine( L"用户名或者密码不能为空,请您重新输入!", L"金山卫士", MB_OK|MB_ICONWARNING);
return FALSE;
}
}
//写配置
if (CBkSafeMsgBox2::ShowMultLine( L"您确定要对您刚修改的配置进行保存吗?", L"金山卫士", MB_OKCANCEL|MB_ICONWARNING) == IDOK)
{
//向后台进行设置
if (nType == 0)
emType = EM_KXE_NETPROXY_TYPE_NOPROXY;
if (nType == 1)
emType = EM_KXE_NETPROXY_TYPE_HTTP;
else if (nType == 2)
emType = EM_KXE_NETPROXY_TYPE_SOCKET5;
std::wstring sHost(strAddr);
std::wstring sUser(strAccount);
std::wstring sPass(strPass);
KXE_CLOUD_PROXY_INFO ProxInfo;
ProxInfo.emProxyType = emType;
ProxInfo.strProxyHost = sHost;
ProxInfo.dwProxyPort = nPort;
ProxInfo.strProxyUsername = sUser;
ProxInfo.strProxyPassword = sPass;
hr = m_kwsScanner.SetCloudProxyInfo(ProxInfo);
if (hr != 0)//设置失败
{
CBkSafeMsgBox2::ShowMultLine( L"保存失败,请您重新设置?", L"金山卫士", MB_OKCANCEL|MB_ICONWARNING);
return FALSE;
}
//后台设置成功后 再写配置文件
IniFile.SetIntValue(TEXT("proxy"),TEXT("type"), nType);
IniFile.SetStrValue(TEXT("proxy"),TEXT("host"), strAddr);
IniFile.SetIntValue(TEXT("proxy"),TEXT("port"), nPort);
IniFile.SetIntValue(TEXT("proxy"),TEXT("validate"), nVerify);
IniFile.SetStrValue(TEXT("proxy"),TEXT("user"), strAccount);
IniFile.SetStrValue(TEXT("proxy"),TEXT("password"), strPass);
NotifyDownModuleProxyChange( nType, strAddr, nPort, (BOOL)nVerify, strAccount, strPass );
GetParent().PostMessage( MSG_PROXY_CHANGE, NULL, NULL );
}
else
{
//.........这里部分代码省略.........