• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ListBox_GetCurSel函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ListBox_GetCurSel函数的典型用法代码示例。如果您正苦于以下问题:C++ ListBox_GetCurSel函数的具体用法?C++ ListBox_GetCurSel怎么用?C++ ListBox_GetCurSel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: MaybeEnableAddButton

/*
 * MaybeEnableAddButton: Enable/disable the "add spell" button
 *   depending on whether the currently selected spell in the available
 *   list box can be chosen.
 */
void MaybeEnableAddButton(HWND hDlg)
{
   int i;
   int school = 0;
   Spell *s;
   BOOL enable = TRUE;
   int index = ListBox_GetCurSel(hList1);
   if (index != LB_ERR)
   {
      // First find any chosen Qor/Shallile spells
      for (i = 0; i < ListBox_GetCount(hList2); ++i)
      {
         s = (Spell *) ListBox_GetItemData(hList2, i);
         if (s->school == SS_QOR || s->school == SS_SHALILLE)
            school = s->school;
      }
      
      // If school of selected spell conflicts, disable button
      s = (Spell *) ListBox_GetItemData(hList1, index);
      
      if (school == SS_QOR && s->school == SS_SHALILLE ||
          school == SS_SHALILLE && s->school == SS_QOR)
         enable = FALSE;
   }

   EnableWindow(GetDlgItem(hDlg, IDC_ADDSPELL), enable);
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:32,代码来源:charspel.c


示例2: GetDlgItem

void plResponderProc::ICreateCmdRollups()
{
    // Get the index of the current command
    HWND hCmds = GetDlgItem(fhDlg, IDC_CMD_LIST);
    int cmdIdx = ListBox_GetCurSel(hCmds);

    if (cmdIdx != LB_ERR && cmdIdx != fCmdIdx)
    {
        fCmdIdx = cmdIdx;
        fIgnoreNextDrop = true;

        // Save the current scroll position and reset it at the end, so the panels
        // won't always jerk back up to the top
        IRollupWindow *rollup = GetCOREInterface()->GetCommandPanelRollup();
        int scrollPos = rollup->GetScrollPos();

        // Destroy the last command's rollups
        IRemoveCmdRollups();

        // Create the rollup for the current command
        IParamBlock2 *pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdParams, 0, fCmdIdx);
        fCmdMap = ICreateMap(pb);

        ResponderWait::InitDlg(fStatePB, fCmdIdx, GetDlgItem(fhDlg, IDC_CMD_LIST));
        pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdWait, 0, fCmdIdx);
        fWaitMap = ICreateMap(pb);

        rollup->SetScrollPos(scrollPos);
    }
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:30,代码来源:plResponderComponent.cpp


示例3: PhGetListBoxString

PPH_STRING PhGetListBoxString(
    _In_ HWND hwnd,
    _In_ INT Index
    )
{
    PPH_STRING string;
    ULONG length;

    if (Index == -1)
    {
        Index = ListBox_GetCurSel(hwnd);

        if (Index == -1)
            return NULL;
    }

    length = ListBox_GetTextLen(hwnd, Index);

    if (length == LB_ERR)
        return NULL;
    if (length == 0)
        return PhReferenceEmptyString();

    string = PhCreateStringEx(NULL, length * 2);

    if (ListBox_GetText(hwnd, Index, string->Buffer) != LB_ERR)
    {
        return string;
    }
    else
    {
        PhDereferenceObject(string);
        return NULL;
    }
}
开发者ID:lei720,项目名称:processhacker2,代码行数:35,代码来源:guisup.c


示例4: GetSelectedElement

CUserControlListElement* CUserControlList::GetSelectedElement()
{
	//получить индекс выделенного элемента
	UINT ElementIndex=ListBox_GetCurSel(mhWindow);
	if(ElementIndex==LB_ERR) return NULL;
	return (CUserControlListElement*)ListBox_GetItemData(mhWindow,ElementIndex);
}
开发者ID:revel8n,项目名称:code0,代码行数:7,代码来源:usercontrol_list.cpp


示例5: Cls_OnAdvCommand

void Cls_OnAdvCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
//WM_COMMAND handler
{
	int     index;
	DWORD   dwItem;
	
	switch(codeNotify)
	{
		case LBN_SELCHANGE:
			index = ListBox_GetCurSel(hSettingsListbox);
			dwItem = ListBox_GetItemData(hSettingsListbox, index);
			
			if ( hCurrentDlg )
				ShowWindow(hCurrentDlg, SW_HIDE);
				
			if ( dwItem IS IDI_ERROR_LOG )
				hCurrentDlg = hErrLogDlg;
			else if ( dwItem IS IDI_ERROR_HANDLING )
				hCurrentDlg = hErrorsDlg;
			else if ( dwItem IS IDI_MEMORY )
				hCurrentDlg = hMemoryDlg;
			else if ( dwItem IS IDI_SECURITY )
				hCurrentDlg = hSecurityDlg;
			else if ( dwItem IS IDI_SETUP )
				hCurrentDlg = hSetupDlg;
			else if ( dwItem IS IDI_OUTPUT )
				hCurrentDlg = hOutputDlg;
			ShowWindow(hCurrentDlg, SW_SHOW);
			break;

			default:
				;
	}
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:34,代码来源:advanced.c


示例6: GetDlgItem

bool plMtlEventProc::IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int resID)
{
    if (cmd == LBN_SELCHANGE && resID == IDC_EVENT_LIST)
    {
        HWND hList = GetDlgItem(hWnd, IDC_EVENT_LIST);
        int idx = ListBox_GetCurSel(hList);
        BOOL selected = ListBox_GetSel(hList, idx);
        int eventType = ListBox_GetItemData(hList, idx);

        if (eventType == kAnimEventBegin)
            pb->SetValue(kMtlBegin, 0, selected);
        else if (eventType == kAnimEventEnd)
            pb->SetValue(kMtlEnd, 0, selected);
        else if (eventType == kAnimEventMarker)
        {
            char buf[256];
            ListBox_GetText(hList, idx, buf);
            ST::string text = ST::string::from_utf8(buf);
            if (selected)
            {
                if (!IsMarkerSelected(pb, kMtlMarkers, text))
                {
                    TCHAR* name = buf;
                    pb->Append(kMtlMarkers, 1, &name);
                }
            }
            else
                IsMarkerSelected(pb, kMtlMarkers, text, true);
        }

        return true;
    }

    return false;
}
开发者ID:H-uru,项目名称:Plasma,代码行数:35,代码来源:plAnimEventComponent.cpp


示例7: ViewNoises_NoiseChanged

VOID ViewNoises_NoiseChanged( HWND hwnd )
{
    INT i;
    CHAR szBuf[128];
    LRESULT lResult;

    lResult = ListBox_GetCurSel(GetDlgItem(hwnd, IDC_NOISE_LIST));

    if (lResult >= 0 && lResult < po->nNoises)
    {
        i = (INT)lResult;

        DoubleToString(szBuf, po->pNoiseData[i].radius, 0);
        Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_RADIUS), szBuf);

        DoubleToString(szBuf, po->pNoiseData[i].height, 0);
        Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_HEIGHT), szBuf);

        wsprintf(szBuf, "%d", po->pNoiseData[i].delay);
        Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_DELAY), szBuf);
    }

    return;

} // ViewNoises_NoiseChanged
开发者ID:CireG,项目名称:Alien-Cabal-VEdit,代码行数:25,代码来源:NOISEDLG.C


示例8: 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);
		}
	}
}
开发者ID:abt8WG,项目名称:EDCB,代码行数:26,代码来源:SetDlgNetwork.cpp


示例9: wxCHECK_MSG

// Get single selection, for single choice list items
int wxListBox::GetSelection() const
{
    wxCHECK_MSG( !HasMultipleSelection(),
                 -1,
                 wxT("GetSelection() can't be used with multiple-selection listboxes, use GetSelections() instead.") );

    return ListBox_GetCurSel(GetHwnd());
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:9,代码来源:listbox.cpp


示例10: ListBox_GetCurSel

void ProjectConfigDialog::onButtonRemoveSearchPathClicked(void)
{
    int index = ListBox_GetCurSel(GetDlgItem(m_hwndDialog, IDC_LIST_PACKAGE_SEARCH_PATHS));
    if (index != LB_ERR)
    {
        ListBox_DeleteString(GetDlgItem(m_hwndDialog, IDC_LIST_PACKAGE_SEARCH_PATHS), index);
        m_project.setPackagePath(makeSearchPath().c_str());
    }
}
开发者ID:AlexYanJianhua,项目名称:quick-cocos2d-x,代码行数:9,代码来源:ProjectConfigDialog.cpp


示例11: TPack_ExtractSelected

void TPack_ExtractSelected(TPack_WindowData * pData)
{
	HWND            hLB = GetDlgItem(pData->hwnd, IDC_TEXTURELIST);
	int             nSel;
	BitmapEntry *	pEntry;
	char            szName[MAX_TEXTURE_NAME_LENGTH];
	char            szFile[MAX_PATH];
	char            szPath[MAX_PATH];
	int             nErrorCode;

	//----------------------------------------------
	// Get current selected list box entry.
	// Get the  geBitmap.
	// Write 8-bit BMP file.
	//----------------------------------------------

	// Ouput to the current directory
	GetCurrentDirectory(MAX_PATH, szPath);

	nSel = ListBox_GetCurSel(hLB);
	if (nSel != LB_ERR)

	if (ListBox_GetText(hLB, nSel, szName) != LB_ERR)
	{
		pEntry = FindBitmap(pData, szName);
		if (pEntry)
		{
			// Create an output file name
			strcpy(szFile, szPath);
			strcat(szFile, "\\");
			strcat(szFile, pEntry->Name);
			strcat(szFile, ".bmp");

			nErrorCode = WriteBMP8(szFile, pEntry->Bitmap);

			if (nErrorCode != TPACKERROR_OK)
			{
				// Error writing this bitmap
				switch (nErrorCode)
				{
					case TPACKERROR_CREATEFILE:
						NonFatalError("Unable to create output file %s", szFile);
						break;
					case TPACKERROR_WRITE:
						NonFatalError("I/O error writing %s", szFile);
						break;
					case TPACKERROR_MEMORYALLOCATION:
						NonFatalError("Memory allocation error writing %s", szFile);
						break;
					case TPACKERROR_UNKNOWN:
					default:
						NonFatalError("UInknown error writing %s", szFile);
				}
			}
		}
	}
}
开发者ID:RealityFactory,项目名称:Genesis3D-Tools,代码行数:57,代码来源:TPack.c


示例12: w32g_rotate_playlist

void w32g_rotate_playlist(int dest)
{
    int i, i1, i2;
    HWND hListBox;
    PlayListEntry save;
	char temp[1024];

    if(playlist.nfiles == 0)
	return;
    if(!(hListBox = playlist_box()))
	return;

    i1 = ListBox_GetCurSel(hListBox);
    i2 = playlist.nfiles - 1;
    if(i1 >= i2)
	return;

#ifdef W32G_RANDOM_IS_SHUFFLE
	w32g_shuffle_playlist_rotate(dest,i1,i2);
#endif
    if(dest > 0)
    {
	save = playlist.list[i2];
	for(i = i2; i > i1; i--) /* i: i2 -> i1 */
	    playlist.list[i] = playlist.list[i - 1];
	playlist.list[i] = save;
	ListBox_GetText(hListBox,i2,temp);
    ListBox_DeleteString(hListBox,i2);
    ListBox_InsertString(hListBox,i1,temp);
	ListBox_SetCurSel(hListBox,i1);
	if(playlist.selected == i2){
	    playlist.selected = i1;
		w32g_update_playlist_pos(playlist.selected);
	} else if(i1 <= playlist.selected && playlist.selected < i2){
	    playlist.selected++;
		w32g_update_playlist_pos(playlist.selected);
	}
    }
    else
    {
	save = playlist.list[i1];
	for(i = i1; i < i2; i++) /* i: i1 -> i2 */
	    playlist.list[i] = playlist.list[i + 1];
	playlist.list[i] = save;
	ListBox_GetText(hListBox,i1,temp);
    ListBox_DeleteString(hListBox,i1);
    ListBox_InsertString(hListBox,-1,temp);
	ListBox_SetCurSel(hListBox,i1);
	if(playlist.selected == i1){
	    playlist.selected = i2;
		w32g_update_playlist_pos(playlist.selected);
	} else if(i1 < playlist.selected && playlist.selected <= i2){
	    playlist.selected--;    
		w32g_update_playlist_pos(playlist.selected);
	}
    }
}
开发者ID:Distrotech,项目名称:TiMidity,代码行数:57,代码来源:w32g_playlist.c


示例13: sd_OnCommand

/*
 * OnCommand()
 */
void sd_OnCommand(HWND storeDlg, UINT cmdID, HWND ctrl, UINT notify)
{
    int lbxIndex;
    int itemGroupIndex;
    int lbxCount;

    switch (cmdID) {
        case IDOK:
            if (sd_itemToStore == SI_VCED) {
                itemGroupIndex = SI_VMEM;
                lbxCount = 16;
            } else { /* (sd_itemToStore == SI_PCED) */
                itemGroupIndex = SI_PMEM;
                lbxCount = 12;
            }
            *sd_destIndex = ListBox_GetCurSel(sd_lbx[0]);
            if (*sd_destIndex == -1) {
                *sd_destIndex = lbxCount + ListBox_GetCurSel(sd_lbx[1]);
            }
            *sd_destIndex += itemGroupIndex;
        case IDCANCEL:
            EndDialog(storeDlg, cmdID);
            break;
        case IDC_STORE1_LBX:
            lbxIndex = 0;
            goto LBX_INDEX_SET;
        case IDC_STORE2_LBX:
            lbxIndex = 1;
LBX_INDEX_SET:
            if (notify == LBN_SETFOCUS) {
                /*
                 * Allow only one selection among both list boxes.
                 */
                ListBox_SetCurSel(sd_lbx[1 - lbxIndex], -1);
            } else if (notify == LBN_DBLCLK) {
                /*
                 * Double clicking an item is equivalent to clicking OK.
                 */
                PostMessage(storeDlg, WM_COMMAND, IDOK, 0);
            }
            break;
    }
}
开发者ID:fourks,项目名称:tx81z-programmer,代码行数:46,代码来源:storedlg.c


示例14: ListBox_GetCurSel

void CCreateBoundingWindow::OnClickDeleteButton()
{
	int selectedIndex = ListBox_GetCurSel(mBoundingsList);
	if (selectedIndex == -1)
		return;

	CEditorScene* scene = CEditorScene::getInstance();
	scene->DeleteBounding(selectedIndex);
	ListBox_DeleteString(mBoundingsList, selectedIndex);
}
开发者ID:Wu1994,项目名称:GameFinal,代码行数:10,代码来源:CCreateBoundingWindow.cpp


示例15: ListBox_GetCurSel

int CCreateLightNodeWindow::GetSelectedItemId()
{
	int itemIndex = ListBox_GetCurSel(mLightNodesList);
	if (itemIndex != LB_ERR)
	{
		u32 id = ListBox_GetItemData(mLightNodesList, itemIndex);
		return id;
	}
	return -1;
}
开发者ID:Wu1994,项目名称:GameFinal,代码行数:10,代码来源:CCreateLightNodeWindow.cpp


示例16: w32g_refine_playlist

int w32g_refine_playlist(int *is_selected_removed)
{
    int nremoved;
    int i, j1, j2, cursel;
    HWND hListBox;

    hListBox = playlist_box();
    if(hListBox)
	cursel = ListBox_GetCurSel(hListBox);
    else
	cursel = -1;

    if(is_selected_removed != NULL)
	*is_selected_removed = 0;
    nremoved = 0;
    j1 = j2 = 0;
    while(j2 < playlist.nfiles) /* j1 <= j2 */
    {
	if(playlist.list[j2].info->format < 0)
	{
	    nremoved++;
	    free(playlist.list[j2].filename);
		if(j2 == playlist.selected &&
		   is_selected_removed != NULL &&
		   !*is_selected_removed)
		{
		    *is_selected_removed = 1;
		    playlist.selected = j1;
		}
		if(j2 < playlist.selected)
		    playlist.selected--;
		if(j2 < cursel)
		    cursel--;
	}
	else
	{
	    playlist.list[j1] = playlist.list[j2];
	    j1++;
	}
	j2++;
    }
    if(nremoved)
    {
	for(i = 0; i < nremoved; i++)
	    ListBox_DeleteString(hListBox, --playlist.nfiles);
	if(cursel >= playlist.nfiles)
	    cursel = playlist.nfiles - 1;
	if(cursel >= 0){
	    ListBox_SetCurSel(hListBox, cursel);
		SetNumListWnd(cursel,playlist.nfiles);
	}
	w32g_update_playlist();
    }
    return nremoved;
}
开发者ID:Distrotech,项目名称:TiMidity,代码行数:55,代码来源:w32g_playlist.c


示例17: DeleteSelectedElement

VOID CUserControlList::DeleteSelectedElement()
{
	//получить выделенный элемент
	UINT ElementIndex=ListBox_GetCurSel(mhWindow);
	if(ElementIndex!=LB_ERR)
	{
		//удалить элемент
		delete (CUserControlListElement*)ListBox_GetItemData(mhWindow,ElementIndex);
		ListBox_DeleteString(mhWindow,ElementIndex);
	}
}
开发者ID:revel8n,项目名称:code0,代码行数:11,代码来源:usercontrol_list.cpp


示例18: ListBox_GetSelCount

// Return number of selections and an array of selected integers
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
    aSelections.Empty();

    if ( HasMultipleSelection() )
    {
        int countSel = ListBox_GetSelCount(GetHwnd());
        if ( countSel == LB_ERR )
        {
            wxLogDebug(wxT("ListBox_GetSelCount failed"));
        }
        else if ( countSel != 0 )
        {
            int *selections = new int[countSel];

            if ( ListBox_GetSelItems(GetHwnd(),
                                     countSel, selections) == LB_ERR )
            {
                wxLogDebug(wxT("ListBox_GetSelItems failed"));
                countSel = -1;
            }
            else
            {
                aSelections.Alloc(countSel);
                for ( int n = 0; n < countSel; n++ )
                    aSelections.Add(selections[n]);
            }

            delete [] selections;
        }

        return countSel;
    }
    else  // single-selection listbox
    {
        if (ListBox_GetCurSel(GetHwnd()) > -1)
            aSelections.Add(ListBox_GetCurSel(GetHwnd()));

        return aSelections.Count();
    }
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:42,代码来源:listbox.cpp


示例19: GetPickedMtl

static bool GetPickedMtl(HWND hDlg, Mtl** mtl)
{
    HWND hList = GetDlgItem(hDlg, IDC_MTL_LIST);
    int sel = ListBox_GetCurSel(hList);
    if (sel != LB_ERR)
    {
        *mtl = (Mtl*)ListBox_GetItemData(hList, sel);
        return true;
    }

    return false;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:12,代码来源:plPickMaterialMap.cpp


示例20: ViewTriggers_TriggerChanged

VOID ViewTriggers_TriggerChanged( HWND hwnd )
{
  INT i;
  CHAR szBuf[128];
  LRESULT lResult;

  lResult = ListBox_GetCurSel( GetDlgItem( hwnd, IDC_TRIGGER_LIST ) );

  if ( lResult >= 0 && lResult < pLevel->nTriggers )
  {
    i = (INT)lResult;

    DoubleToString( szBuf, pLevel->pTriggerData[i].radius, 0 );
    Edit_SetText( GetDlgItem( hwnd, IDC_TRIGGER_RADIUS ), szBuf );

    DoubleToString( szBuf, pLevel->pTriggerData[i].height, 0 );
    Edit_SetText( GetDlgItem( hwnd, IDC_TRIGGER_HEIGHT ), szBuf );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_PROXIMITY,
                    (pLevel->pTriggerData[i].flags & TF_PROXIMITY_TRIGGER) ? 1 : 0 );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_USER,
                    (pLevel->pTriggerData[i].flags & TF_USER_TRIGGER) ? 1 : 0 );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_SOUND,
                    (pLevel->pTriggerData[i].flags & TF_SOUND) ? 1 : 0 );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_END_LEVEL,
                    (pLevel->pTriggerData[i].flags & TF_END_LEVEL) ? 1 : 0 );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_END_GAME,
                    (pLevel->pTriggerData[i].flags & TF_END_GAME) ? 1 : 0 );

    if (pLevel->pTriggerData[i].flags & TF_ITEM_REQUIRED)
    {
      Static_SetText( GetDlgItem( hwnd, IDC_TRIGGER_ITEM_REQUIRED ),
                      GetItemTypeString( pLevel->pTriggerData[i].item_type ) );
    }
    else
    {
      Static_SetText( GetDlgItem( hwnd, IDC_TRIGGER_ITEM_REQUIRED ),
                      (LPSTR)"" );
    }
  }

  return;
  
} // ViewTriggers_TriggerChanged
开发者ID:CireG,项目名称:Alien-Cabal-VEdit,代码行数:53,代码来源:TRIGDLG.C



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ListBox_GetItemData函数代码示例发布时间:2022-05-30
下一篇:
C++ ListBox_GetCount函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap