本文整理汇总了C++中IAccount::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IAccount::Release方法的具体用法?C++ IAccount::Release怎么用?C++ IAccount::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAccount
的用法示例。
在下文中一共展示了IAccount::Release方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wmain
int wmain()
{
// CoInitialize(NULL);
CoInitializeEx(NULL, COINIT_MULTITHREADED);
IInventory* pInv = NULL;
HRESULT hr = CoCreateInstance(CLSID_Trader, NULL, CLSCTX_INPROC_SERVER, IID_IInventory, reinterpret_cast<LPVOID*>(&pInv));
if(SUCCEEDED(hr))
{
int qty;
double bal;
wcout << L"Number of items to purchase : ";
wcin >> qty;
hr = pInv->Buy(qty, 100);
if(FAILED(hr))
wcout << L"Buy operation failed with error code of " << hex << hr << endl;
else
{
IAccount* pAcc = NULL;
pInv->QueryInterface(IID_IAccount, reinterpret_cast<LPVOID*>(&pAcc));
pInv->GetStock(&qty);
pAcc->GetBalance(&bal);
wcout << L"Current stock : " << qty << endl;
wcout << L"Current balance : " << bal << endl;
pAcc->Release();
}
pInv->Release();
}
else
示例2: LoginLevel
BOOL CDlgLevelInput::LoginLevel(const CString &strAccName, const CString &strAccPwd)
{
CString strUserAcc(""), strPwd("");
if (strAccName.IsEmpty() || strAccPwd.IsEmpty())
{
EnableInput(FALSE);
CString strText;
CString strTitle;
strTitle.LoadString(IDS_STRING_Error);
//////////////////////////////////////////////////////////////////////////
// 获取账号、密码
GetDlgItem(IDC_EDIT_SHACC)->GetWindowText(strUserAcc);
if (strUserAcc.IsEmpty())
{
strText.LoadString(IDS_STRING_AccountError);
MessageBox(strText,strTitle);
EnableInput(TRUE);
GetDlgItem(IDC_EDIT_SHACC)->SetFocus();
return FALSE;
}
strPwd = m_sEdit.GetRealText();
if (strPwd.IsEmpty())
{
strText.LoadString(IDS_STRING_PasswardError);
MessageBox(strText,strTitle);
EnableInput(TRUE);
m_sEdit.SetFocus();
return FALSE;
}
}
else
{
strUserAcc = strAccName;
strPwd = strAccPwd;
}
long handle = g_pDoLogin->ConnectServer(CEV_Connect_LEVEL2);
if (handle)
{// level2服务连接成功
IAccountMng *pTradeAccountMng = g_pDoLogin->m_pTradeCore->GetAccountMng();
if(pTradeAccountMng && pTradeAccountMng->GetCount(atLevel2) == 0)
{
//IAccount* pQHAccount = pTradeAccountMng->Add(atLevel2);
IAccount* pQHAccount = pTradeAccountMng->NewAccount(atLevel2);
if(pQHAccount)
{
pQHAccount->SetLoginAccount(strUserAcc);
pQHAccount->SetCellNo("");
pQHAccount->SetLoginAccountType("");
pQHAccount->SetPassword(strPwd);
pQHAccount->SetServerID(0);
pQHAccount->SetBranchNo("0");
pQHAccount->SetConnectHandle(handle);
CString sMsg = "";
if( pQHAccount->Login(sMsg) )
{
pTradeAccountMng->Add(pQHAccount);
pTradeAccountMng->SetCurrentAccount(pQHAccount);
return TRUE;
}
else
{
pQHAccount->Release();
//pTradeAccountMng->DeleteAccount(pQHAccount);
// CDataSourceInitDataStauts msg;
// strncpy(msg.m_szMsg, sMsg, min(sMsg.GetLength()+1, 256));
// FSetProgressMsg(&msg);
MessageBox(sMsg, "Error", MB_OK | MB_ICONERROR);
}
}
}
}
EnableInput(TRUE);
return TRUE;
}