本文整理汇总了C++中ListBox_SetItemData函数的典型用法代码示例。如果您正苦于以下问题:C++ ListBox_SetItemData函数的具体用法?C++ ListBox_SetItemData怎么用?C++ ListBox_SetItemData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListBox_SetItemData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowWindow
void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symmask)
{
ShowWindow(listbox,SW_HIDE);
ListBox_ResetContent(listbox);
//int style = GetWindowLong(listbox,GWL_STYLE);
ListBox_AddString(listbox,"(0x80000000)");
ListBox_SetItemData(listbox,0,0x80000000);
//ListBox_AddString(listbox,"(0x80002000)");
//ListBox_SetItemData(listbox,1,0x80002000);
for (size_t i = 0; i < entries.size(); i++)
{
if (entries[i].type & symmask)
{
char temp[256];
sprintf(temp,"%s (%d)",entries[i].name,entries[i].size);
int index = ListBox_AddString(listbox,temp);
ListBox_SetItemData(listbox,index,entries[i].vaddress);
}
}
ShowWindow(listbox,SW_SHOW);
}
示例2: ShowWindow
void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symmask)
{
ShowWindow(listbox,SW_HIDE);
ListBox_ResetContent(listbox);
//int style = GetWindowLong(listbox,GWL_STYLE);
ListBox_AddString(listbox,"(0x80000000)");
ListBox_SetItemData(listbox,0,0x80000000);
//ListBox_AddString(listbox,"(0x80002000)");
//ListBox_SetItemData(listbox,1,0x80002000);
SendMessage(listbox, WM_SETREDRAW, FALSE, 0);
SendMessage(listbox, LB_INITSTORAGE, (WPARAM)entries.size(), (LPARAM)entries.size() * 30);
for (size_t i = 0; i < entries.size(); i++)
{
if (entries[i].type & symmask)
{
char temp[256];
sprintf(temp,"%s (%d)",entries[i].name,entries[i].size);
int index = ListBox_AddString(listbox,temp);
ListBox_SetItemData(listbox,index,entries[i].vaddress);
}
}
SendMessage(listbox, WM_SETREDRAW, TRUE, 0);
RedrawWindow(listbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
ShowWindow(listbox,SW_SHOW);
}
示例3: UpdateActiveSymbols
void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symType) {
if (activeNeedUpdate_)
UpdateActiveSymbols();
wchar_t temp[256];
std::lock_guard<std::recursive_mutex> guard(lock_);
SendMessage(listbox, WM_SETREDRAW, FALSE, 0);
ListBox_ResetContent(listbox);
switch (symType) {
case ST_FUNCTION:
{
SendMessage(listbox, LB_INITSTORAGE, (WPARAM)activeFunctions.size(), (LPARAM)activeFunctions.size() * 30);
for (auto it = activeFunctions.begin(), end = activeFunctions.end(); it != end; ++it) {
const FunctionEntry& entry = it->second;
const char* name = GetLabelName(it->first);
if (name != NULL)
wsprintf(temp, L"%S", name);
else
wsprintf(temp, L"0x%08X", it->first);
int index = ListBox_AddString(listbox,temp);
ListBox_SetItemData(listbox,index,it->first);
}
}
break;
case ST_DATA:
{
int count = ARRAYSIZE(defaultSymbols)+(int)activeData.size();
SendMessage(listbox, LB_INITSTORAGE, (WPARAM)count, (LPARAM)count * 30);
for (int i = 0; i < ARRAYSIZE(defaultSymbols); i++) {
wsprintf(temp, L"0x%08X (%S)", defaultSymbols[i].address, defaultSymbols[i].name);
int index = ListBox_AddString(listbox,temp);
ListBox_SetItemData(listbox,index,defaultSymbols[i].address);
}
for (auto it = activeData.begin(), end = activeData.end(); it != end; ++it) {
const DataEntry& entry = it->second;
const char* name = GetLabelName(it->first);
if (name != NULL)
wsprintf(temp, L"%S", name);
else
wsprintf(temp, L"0x%08X", it->first);
int index = ListBox_AddString(listbox,temp);
ListBox_SetItemData(listbox,index,it->first);
}
}
break;
}
SendMessage(listbox, WM_SETREDRAW, TRUE, 0);
RedrawWindow(listbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
}
示例4: wxCHECK_RET
void
wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos)
{
wxCHECK_RET( IsValidInsert(pos),
wxT("invalid index in wxListBox::InsertItems") );
unsigned int nItems = items.GetCount();
for ( unsigned int i = 0; i < nItems; i++ )
{
int idx = ListBox_InsertString(GetHwnd(), i + pos, items[i]);
#if wxUSE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW )
{
wxOwnerDrawn *pNewItem = CreateLboxItem(idx);
pNewItem->SetName(items[i]);
pNewItem->SetFont(GetFont());
m_aItems.Insert(pNewItem, idx);
ListBox_SetItemData(GetHwnd(), idx, pNewItem);
}
#else
wxUnusedVar(idx);
#endif // wxUSE_OWNER_DRAWN
}
m_noItems += nItems;
SetHorizontalExtent();
}
示例5: StatsListChangeStat
/*
* StatsListChangeStat: Redisplay current statistic, whose value has changed.
* Requires that s is a list type stat in the current group.
*/
void StatsListChangeStat(Statistic *s)
{
int index, top;
if (s->num < 0 || s->num > ListBox_GetCount(hList))
{
debug(("StatListChangeList got illegal stat #%d\n", (int) s->num));
return;
}
top = ListBox_GetTopIndex(hList);
index = StatListFindItem(s->num);
if (index == -1)
{
debug(("StatListChangeList got illegal stat #%d\n", (int) s->num));
return;
}
WindowBeginUpdate(hList);
ListBox_DeleteString(hList, index);
index = ListBox_AddString(hList, LookupNameRsc(s->name_res));
ListBox_SetItemData(hList, index, s);
ListBox_SetTopIndex(hList, top);
WindowEndUpdate(hList);
}
示例6: TxLbx_SetItemAttr
/*
* SetItemAttr()
*/
void TxLbx_SetItemAttr(HWND listBox, int lbxItem, TXLBX_ATTR attr)
{
DWORD data = ListBox_GetItemData(listBox, lbxItem) & 0x00FFFFFF;
data |= attr;
ListBox_SetItemData(listBox, lbxItem, data);
}
示例7: ListBox_MoveString
int ListBox_MoveString(HWND hwndListBox, int iIndex, int iNewIndex, BOOL bRelativeToOld)
{
int iCount = ListBox_GetCount(hwndListBox);
int nExactNewIndex;
if (iIndex == 0 && iNewIndex < 0)
iNewIndex = 0;
nExactNewIndex = bRelativeToOld ? (iIndex + iNewIndex) : iNewIndex;
if ((bRelativeToOld && (iIndex + iNewIndex) >= iCount) ||
(iNewIndex >= iCount))
{
return (LB_ERR);
}
else
{
LPTSTR pszBuffer = (LPTSTR)Mem_AllocStr(ListBox_GetTextLen(hwndListBox, iIndex) + SZ);
LPVOID lpVoid = (LPVOID)ListBox_GetItemData(hwndListBox, iIndex);
ListBox_GetText(hwndListBox, iIndex, pszBuffer);
ListBox_DeleteString(hwndListBox, iIndex);
ListBox_InsertString(hwndListBox, nExactNewIndex, pszBuffer);
ListBox_SetItemData(hwndListBox, nExactNewIndex, lpVoid);
Mem_Free(pszBuffer);
}
return (nExactNewIndex);
}
示例8: AddItem
/////////////////////////////////////////////////////////////////////////
//Function: AddItem
//Description: Add a item to Selected object list
/////////////////////////////////////////////////////////////////////////
void AddItem (HWND hDlg)
{
int nObjects ;
char *lpszString ;
int *SelectedIndexes ;
DWORD objectIndex ;
OBJECTID theObj ;
int i ;
//nObjects = (int) SendDlgItemMessage (hDlg, IDD_OBJECTSLIST, LB_GETSELCOUNT, 0, 0L) ;
nObjects = ListBox_GetSelCount (GetDlgItem(hDlg, IDD_OBJECTSLIST)) ;
if (nObjects == 0) return ;
SelectedIndexes = new int[nObjects] ;
//SendDlgItemMessage (hDlg, IDD_OBJECTSLIST, LB_GETSELITEMS, (WPARAM)nObjects, (long)SelectedIndexes) ;
ListBox_GetSelItems (GetDlgItem (hDlg, IDD_OBJECTSLIST), nObjects, SelectedIndexes) ;
lpszString = new char[256] ;
for (i = 0; i < nObjects; i++)
{
//SendDlgItemMessage (hDlg, IDD_OBJECTSLIST, LB_GETTEXT, SelectedIndexes[i], (long) lpszString) ;
//theObj =(OBJECTID)SendDlgItemMessage (hDlg, IDD_OBJECTSLIST, LB_GETITEMDATA, SelectedIndexes[i], 0) ;
//objectIndex = (DWORD)SendDlgItemMessage(hDlg, IDD_FIELDSLIST, LB_INSERTSTRING, -1, (long)lpszString) ;
//SendDlgItemMessage(hDlg, IDD_FIELDSLIST, LB_SETITEMDATA, (WPARAM)objectIndex, (long)theObj) ;
ListBox_GetText (GetDlgItem (hDlg, IDD_FIELDSLIST),SelectedIndexes[i], lpszString) ;
theObj = (OBJECTID)ListBox_GetItemData (GetDlgItem (hDlg, IDD_FIELDSLIST),SelectedIndexes[i]) ;
objectIndex = ListBox_InsertString (GetDlgItem (hDlg, IDD_FIELDSLIST), -1, lpszString) ;
ListBox_SetItemData (GetDlgItem(hDlg, IDD_FIELDSLIST), objectIndex, theObj) ;
}
delete(SelectedIndexes) ;
delete(lpszString) ;
return ;
}
示例9: SendDlgItemMessage
void CSetDlgNetwork::OnBnClickedButtonAddTcp()
{
// TODO: ここにコントロール通知ハンドラー コードを追加します。
DWORD ip = 0;
SendDlgItemMessage(m_hWnd, IDC_IPADDRESS_TCP, IPM_GETADDRESS, 0, (LPARAM)&ip);
UINT tcpPort = GetDlgItemInt(m_hWnd, IDC_EDIT_PORT_TCP, NULL, FALSE);
NW_SEND_INFO item;
item.ip = ip;
item.port = tcpPort;
Format(item.ipString, L"%d.%d.%d.%d",
(item.ip&0xFF000000)>>24,
(item.ip&0x00FF0000)>>16,
(item.ip&0x0000FF00)>>8,
(item.ip&0x000000FF) );
wstring add = L"";
Format(add, L"%s:%d",item.ipString.c_str(), item.port);
item.broadcastFlag = FALSE;
HWND hItem = GetDlgItem(IDC_LIST_IP_TCP);
for( int i=0; i<ListBox_GetCount(hItem); i++ ){
WCHAR buff[256]=L"";
int len = ListBox_GetTextLen(hItem, i);
if( 0 <= len && len < 256 ){
ListBox_GetText(hItem, i, buff);
if(lstrcmpi(buff, add.c_str()) == 0 ){
return ;
}
}
}
int index = ListBox_AddString(hItem, add.c_str());
ListBox_SetItemData(hItem, index, (int)tcpSendList.size());
tcpSendList.push_back(item);
}
示例10: raise_killed_monster
static char raise_killed_monster(HWND hDlg)
{
HWND listdlg = PrepareListWindow(hDlg);
HWND list = GetDlgItem(listdlg,IDC_LIST);
char buff[256];
int i;
int res;
for (i = 0;i<MAX_MOBS;i++) if (~mobs[i].vlajky & MOB_LIVE && mobs[i].cislo_vzoru != 0)
{
int p;
_snprintf(buff,sizeof(buff),"%4d. %s (sector: %d home %d)",i,mobs[i].name,mobs[i].sector,mobs[i].home_pos);
kamenik2windows(buff,strlen(buff),buff);
p = ListBox_AddString(list,buff);
ListBox_SetItemData(list,p,i);
}
res = PumpDialogMessages(listdlg);
while (res == IDOK)
{
int cnt;
for (i = 0,cnt = ListBox_GetCount(list);i<cnt;i++) if (ListBox_GetSel(list,i))
{
int idx = ListBox_GetItemData(list,i);
mobs[idx].vlajky |= MOB_LIVE;
mobs[idx].lives = mobs[idx].vlastnosti[VLS_MAXHIT];
wzprintf("%s znovu povstal(a)\r\n",mobs[idx].name);
SEND_LOG("(WIZARD) '%s' has been raised",mobs[idx].name,0);
}
res = PumpDialogMessages(listdlg);
}
CloseListWindow(listdlg);
return 1;
}
示例11: DoSetItemClientData
void wxListBox::DoSetItemClientData(unsigned int n, void *clientData)
{
if ( ListBox_SetItemData(GetHwnd(), n, clientData) == LB_ERR )
{
wxLogDebug(wxT("LB_SETITEMDATA failed"));
}
}
示例12: TxLbx_ReplaceItem
/*
* ReplaceItem() -
*/
void TxLbx_ReplaceItem(HWND listBox, int idx, const _TUCHAR *text, DWORD itemData
, TXLBX_ATTR attr)
{
ListBox_DeleteString(listBox, idx);
ListBox_InsertString(listBox, idx, text);
ListBox_SetItemData(listBox, idx, attr | (itemData & 0x00FFFFFF));
}
示例13: ComboBox_GetCurSel
void CCreateBoundingWindow::OnClickCreateButton()
{
int selectedIndex = ComboBox_GetCurSel(mBoundingCategoryComboBox);
if (selectedIndex == -1)
return;
TCHAR boundingName[128];
SendMessage(mBoundingCategoryComboBox, CB_GETLBTEXT, selectedIndex, (LPARAM)boundingName);
CEditorScene* scene = CEditorScene::getInstance();
int boundingCategory = selectedIndex;
if (selectedIndex == BOX_BOUNDING)
{
scene->AddBoxBounding();
}
else if (selectedIndex == CYLINDER_BOUNDING)
{
scene->AddCylinderBounding();
}
int index = ListBox_AddString(mBoundingsList, boundingName);
ListBox_SetItemData(mBoundingsList, index, boundingCategory);
}
示例14: GetDlgItem
void CSetDlgNetwork::OnBnClickedButtonDelUdp()
{
// TODO: ここにコントロール通知ハンドラー コードを追加します。
HWND hItem = GetDlgItem(IDC_LIST_IP_UDP);
int sel = ListBox_GetCurSel(hItem);
if( sel != LB_ERR ){
int index = (int)ListBox_GetItemData(hItem, sel);
vector<NW_SEND_INFO>::iterator itr;
itr = udpSendList.begin();
advance(itr, index);
udpSendList.erase(itr);
ListBox_ResetContent(hItem);
for( int i=0; i<(int)udpSendList.size(); i++ ){
wstring add = L"";
Format(add, L"%s:%d",udpSendList[i].ipString.c_str(), udpSendList[i].port);
if( udpSendList[i].broadcastFlag == TRUE ){
add+= L" ブロードキャスト";
}
index = ListBox_AddString(hItem, add.c_str());
ListBox_SetItemData(hItem, index, i);
}
}
}
示例15: ST_LITERAL
void plAgeDescInterface::INewPage()
{
ST::string name = ST_LITERAL("New Page Name");
// Get the name of the new age from the user
int ret = DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_AGE_NAME),
GetCOREInterface()->GetMAXHWnd(),
NewAgeDlgProc,
(LPARAM)&name);
if (ret != 1)
return;
HWND hPages = GetDlgItem(fhDlg, IDC_PAGE_LIST);
// Make sure this page doesn't already exist
int count = ListBox_GetCount(hPages);
for (int i = 0; i < count; i++)
{
char pageName[256];
ListBox_GetText(hPages, i, pageName);
if (!name.compare_i(pageName))
return;
}
// Add the new page and select it
int idx = ListBox_AddString(hPages, name.c_str());
// Choose a new sequence suffix for it
plAgePage *newPage = new plAgePage( name, IGetFreePageSeqSuffix( hPages ), 0 );
ListBox_SetItemData( hPages, idx, (LPARAM)newPage );
fDirty = true;
}