本文整理汇总了C++中CListBox::GetItemDataPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ CListBox::GetItemDataPtr方法的具体用法?C++ CListBox::GetItemDataPtr怎么用?C++ CListBox::GetItemDataPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CListBox
的用法示例。
在下文中一共展示了CListBox::GetItemDataPtr方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildSearchList
void CDlgReplaceBox::BuildSearchList()
{
// Build the list box
CListBox* theListBox = (CListBox*) GetDlgItem( FINDGET_LIST );
theListBox->ResetContent();
// Ensure the string is in Lower case for searching
m_search_string.MakeLower();
CLibraryCollection::FillMatchingSymbols( theListBox, m_search_string, NULL );
// Try and find the selected symbol in the list
int i;
for (i = 0; i < theListBox->GetCount(); i++)
{
if (theListBox->GetItemDataPtr( i ) == m_Symbol)
{
theListBox->SetCurSel( i );
break;
}
}
if (i == theListBox->GetCount())
{
m_Symbol = NULL;
GetDlgItem( IDC_SHOW_SYMBOL )->RedrawWindow();
}
}
示例2: OnBnClickedSend
void CNewsHubDlg::OnBnClickedSend()
{
CListBox* pRunningClients = (CListBox*)GetDlgItem(IDC_RUNNING_CLIENTS);
int row = pRunningClients->GetCurSel();
if (row == LB_ERR)
{
MessageBox(_T("Please select one of running clients to send message through"), _T("No client selected"), MB_OK);
return;
}
CEdit* pMessage = (CEdit*)GetDlgItem(IDC_MESSAGE);
CString message;
pMessage->GetWindowText(message);
ClientLoop* clientLoop = (ClientLoop*)pRunningClients->GetItemDataPtr(row);
unsigned int messageId = clientLoop->nextMessageId();
clientLoop->Queue()->AddMessage(messageId, std::string(CT2CA(message)));
CListBox* pSentMessages = (CListBox*)GetDlgItem(IDC_SENT_MESSAGES);
NewsHub::TcpClient* tcpClient = (NewsHub::TcpClient*)clientLoop->Client();
CString str;
str.Format(_T("(To: %s:%d msgId:%d): %s"),
CString(tcpClient->Host().c_str()), tcpClient->Port(), messageId, message);
row = pSentMessages->AddString(str);
MessageInfo* messageInfo = new MessageInfo;
messageInfo->queue = clientLoop->Queue();
messageInfo->messageId = messageId;
pSentMessages->SetItemDataPtr(row, messageInfo);
pSentMessages->SetCurSel(row);
}
示例3: OnSelchangeList
void CDlgReplaceBox::OnSelchangeList()
{
CListBox* theListBox = (CListBox*) GetDlgItem( FINDGET_LIST );
int WhichItem = theListBox->GetCurSel();
if (WhichItem != LB_ERR)
{
m_Symbol = static_cast<CLibraryStoreSymbol *>(theListBox->GetItemDataPtr( WhichItem ));
GetDlgItem( IDC_SHOW_SYMBOL )->RedrawWindow();
}
}
示例4: OnBnClickedServerFinish
void CNewsHubDlg::OnBnClickedServerFinish()
{
CListBox* pRunningServers = (CListBox*)GetDlgItem(IDC_RUNNING_SERVERS);
int row = pRunningServers->GetCurSel();
if (row != LB_ERR)
{
ServerLoop* serverLoop = (ServerLoop*)pRunningServers->GetItemDataPtr(row);
delete serverLoop;
pRunningServers->DeleteString(row);
}
}
示例5: onClose
void CNewsHubDlg::onClose()
{
CListBox* pRunningServers = (CListBox*)GetDlgItem(IDC_RUNNING_SERVERS);
for (int i = 0; i < pRunningServers->GetCount(); ++i)
{
ServerLoop* serverLoop = (ServerLoop*)pRunningServers->GetItemDataPtr(i);
delete serverLoop;
}
CListBox* pRunningClients = (CListBox*)GetDlgItem(IDC_RUNNING_CLIENTS);
for (int i = 0; i < pRunningClients->GetCount(); ++i)
{
ClientLoop* clientLoop = (ClientLoop*)pRunningClients->GetItemDataPtr(i);
delete clientLoop;
}
CListBox* pSentMessages = (CListBox*)GetDlgItem(IDC_SENT_MESSAGES);
for (int i = 0; i < pSentMessages->GetCount(); ++i)
{
MessageInfo* messageInfo = (MessageInfo*)pSentMessages->GetItemDataPtr(i);
delete messageInfo;
}
}
示例6: GetActiveBridge
bool CFanmotorDlg::GetActiveBridge(CString& BridgeID)
{
CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
listBoxBridges->SetCurSel(0);
BridgeID = L"";
if (listBoxBridges->GetCurSel() < 0)
{
DisplayInforMessageBox((LPCWSTR)L"Error", L"Select Active BRIDGE!");
return false;
}
CBridgeInfo* bridgeInfo = (CBridgeInfo*)listBoxBridges->GetItemDataPtr(listBoxBridges->GetCurSel());
BridgeID = bridgeInfo->BridgeID;
return true;
}
示例7: MessageDelivered
void CNewsHubDlg::MessageDelivered(NewsHub::ClientQueueThreadLoop* queue, const NewsHub::Socket & socket, const unsigned int messageId, const std::string & message)
{
CListBox* pSentMessages = (CListBox*)GetDlgItem(IDC_SENT_MESSAGES);
for (int i = 0; i < pSentMessages->GetCount(); ++i)
{
MessageInfo* messageInfo = (MessageInfo*)pSentMessages->GetItemDataPtr(i);
if ((messageInfo->queue == queue) && (messageInfo->messageId == messageId))
{
CString str;
pSentMessages->GetText(i, str);
pSentMessages->DeleteString(i);
pSentMessages->InsertString(i, str + _T(": Delivered"));
pSentMessages->SetItemDataPtr(i, messageInfo);
pSentMessages->SetCurSel(i);
break;
}
}
}
示例8: RemoveBridgeEvent
void CFanmotorDlg::RemoveBridgeEvent(BSTR BridgeID)
{
int i;
CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
CBridgeInfo* bridgeInfo = NULL;
for (i=0; i<listBoxBridges->GetCount(); i++)
{
bridgeInfo = (CBridgeInfo*)listBoxBridges->GetItemDataPtr(i);
if (bridgeInfo->BridgeID == BridgeID) break;
}
if (i == listBoxBridges->GetCurSel())
{
CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
listBoxDevices->ResetContent();
// ResetPowerSettings();
// ResetSpeedSettings();
}
if ((i>=0)&&(i<=listBoxBridges->GetCount()))
{
delete bridgeInfo;
listBoxBridges->DeleteString(i);
}
}