/*
*函数介绍:线程执行过程
*入口参数:pArg:创建线程时,传进来的参数,这里指的列表框控件指针
*出口参数:(无)
*返回值:这里只返回1。
*/
DWORD  CThreadSynBySemaphoreDlg::ThreadProc(PVOID pArg)
{

	CListBox* pLstBox = (CListBox*)pArg;

	TCHAR buffer[10];
	//等待信号量可用,当信号量计数大于0时,可用
	if (WaitForSingleObject(g_hSynSemaphore,INFINITE) == WAIT_OBJECT_0)
	{

		//给数组赋值
		for (int i=0;i<MAXDATASIZE;i++)
		{
			g_incNum++;  //加1
			g_aGlobalData[i] = g_incNum;  //赋值
			Sleep(5);
		}
		
		//显示已经赋值的数组
		for(int i = 0 ; i < MAXDATASIZE ; i++)
		{
			_itow(g_aGlobalData[i],buffer,10);
			pLstBox->AddString(buffer);  //
		}
	}
	//因为等待函数自动给信号量计数减1
	//所以给信号量计数加1,使信号量继续可用
	ReleaseSemaphore(g_hSynSemaphore,1,NULL);
	return 1;
}
示例#2
0
文件: mainmenu.cpp 项目: paud/d2x-xl
static void PlayMenuMovie (void)
{
	int				h, i, j;
	CStack<char*>	m;
	char*				ps;
	CListBox			lb;

i = movieManager.m_nLibs;
for (h = j = 0; j < i; j++)
	if (j != 2)	//skip robot movies
		h += movieManager.m_libs [j].m_nMovies;
if (!h)
	return;
if (!m.Create (h))
	return;
for (i = j = 0; i < h; i++)
	if ((ps = movieManager.Cycle (i == 0, 0))) {
		if (j && !strcmp (ps, m [0]))
			break;
		m.Push (ps);
		}
i = lb.ListBox (TXT_SELECT_MOVIE, m);
if (i > -1) {
	SDL_ShowCursor (0);
	if (strstr (m [i], "intro"))
		subTitles.Init ("intro.tex");
	else if (strstr (m [i], ENDMOVIE))
		subTitles.Init (ENDMOVIE ".tex");
	movieManager.Play (m [i], 1, 1, gameOpts->movies.bResize);
	subTitles.Close ();
	SDL_ShowCursor (1);
	}
songManager.PlayCurrent (1);
}
示例#3
0
LRESULT PreviewLogDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	GetDlgItem(IDC_PRV_DLG_SERVER_GROUP).SetWindowText(CTSTRING(PRV_DLG_SERVER_GROUP));
	GetDlgItem(IDC_PRV_DLG_SERVER_STATE_STATIC).SetWindowText(CTSTRING(PRV_DLG_SERVER_STATE_STATIC));
	
	
	GetDlgItem(IDC_PRV_DLG_VIDEO_NAME_STATIC).SetWindowText(CTSTRING(PRV_DLG_VIDEO_NAME_STATIC));
	GetDlgItem(IDC_PRV_DLG_LOG_GROUP).SetWindowText(CTSTRING(PRV_DLG_LOG_GROUP));
	
	CenterWindow(GetParent());
	GetDlgItem(IDCANCEL).SetWindowText(CTSTRING(CLOSE));
	
	SetWindowText(CTSTRING(PREVIEW_LOG_DLG));
	
	UpdateItems();
	
	// Fill IDC_PRV_DLG_LOG_LST
	
	CListBox mBox;
	mBox.Attach(GetDlgItem(IDC_PRV_DLG_LOG_LST));
	string outString;
	while (VideoPreview::getInstance()->GetNextLogItem(outString))
		mBox.AddString(Text::toT(outString).c_str());
	mBox.Detach();
	
	VideoPreview::getInstance()->SetLogDlgWnd(*this);
	
	return FALSE;
}
示例#4
0
void CTTComboBox::AlignListBoxWithCombo()
{
	if (m_cbi.hwndList == NULL ||
		!::IsWindow(m_cbi.hwndList))
		return;

	CListBox* pList = (CListBox*)CWnd::FromHandle(m_cbi.hwndList);
	CRect l_rcCombo;
	GetClientRect(&l_rcCombo);
	CRect l_rcList;
	pList->GetClientRect(&l_rcList);
	int dropWidth = GetDroppedWidth();
	int listWidth = l_rcList.Width();
	int xOffset = 0;
	switch (m_alignStyle)
	{
	case 0:
		xOffset = 0;
		break;
	case 1:
		xOffset = dropWidth - l_rcCombo.Width();
		break;
	case 2:
		xOffset = (dropWidth - l_rcCombo.Width()) / 2;
		break;
	default:
		xOffset = 0;
		break;
	}
	pList->ClientToScreen(&l_rcList);
	pList->SetWindowPos(NULL, l_rcList.left - xOffset, l_rcList.top, 0, 0, SWP_NOSIZE);
}
示例#5
0
//客户端连接断开消息函数
LONG CTCPServerDlg::OnClientConnect(WPARAM wParam,LPARAM lParam)
{
	int iIndex;
	TCHAR *szAddress = (TCHAR*)lParam;
	CString strAddrss = szAddress;
	
	CListBox * pLstConn = (CListBox*)GetDlgItem(IDC_LST_CONN);
	ASSERT(pLstConn != NULL);

	if (wParam == 0)
	{
		pLstConn->AddString(strAddrss + _T("建立连接"));
	}
	else
	{
		iIndex = pLstConn->FindString(iIndex,strAddrss + _T("建立连接"));
		if (iIndex != LB_ERR)
		{
			pLstConn->DeleteString(iIndex); 
		}
	}

	//释放内存
	delete[] szAddress;
	szAddress = NULL;
	return 0;
}
示例#6
0
void CNewsHubDlg::OnBnClickedServerStart()
{
  CEdit* pPort = (CEdit*)GetDlgItem(IDC_SERVER_PORT);
  CString strPort;
  pPort->GetWindowText(strPort);
  int port = atoi(CT2CA(strPort));

  CButton* pServerTcp = (CButton*)GetDlgItem(IDC_SERVER_TCP);
  bool bTcp = (pServerTcp->GetCheck() == BST_CHECKED);

  ServerLoop* serverLoop;
  try
  {
    NewsHub::Server* server;
    if (bTcp)
      server = new NewsHub::TcpServer(port);
    else
      server = new NewsHub::UdpServer(port);
    serverLoop = new ServerLoop(server, new NewsHub::ServerThreadLoop(*server, *this, bTcp));
  }
  catch (std::exception & e)
  {
    MessageBox(CString(e.what()), _T("Exception"), MB_OK);
    return;
  }

  CString serverDescription = CString(bTcp?"TCP":"UDP") + CString(" server is listening on port ") + strPort; 

  CListBox* pRunningServers = (CListBox*)GetDlgItem(IDC_RUNNING_SERVERS);
  int row = pRunningServers->AddString(serverDescription);
  pRunningServers->SetItemDataPtr(row, serverLoop);
}
void AnimDialog::LoadAnimList()
{
	CListBox *pAnimList = static_cast< CListBox* >( GetDlgItem( IDC_LIST_ANIM ) );

	ClearAnimList();

	ModelBase *pMB = m_pDM->GetMesh();
	AnimatableBase *pMesh = dynamic_cast< AnimatableBase* >( pMB );
	if ( pMesh != NULL )
	{
		int animNum = pMesh->GetAnimNum();
		for ( int i = 0; i < animNum; i ++ )
		{
			CSMAnimation anim = pMesh->GetAnimInfo( i );

			pAnimList->AddString( anim.animName.c_str() );
		}
		if ( animNum == 0 )
		{
			EnableAnimControls( FALSE );
		}
		else
		{
			EnableAnimControls( TRUE );
			pAnimList->SetCurSel( 0 );
		}
	}
}
void CChangeOrderDlg::removeSelected(const CompactIntArray &selected) {
  CListBox *lb = getListBox();
  for(intptr_t i = selected.size() - 1; i >= 0; i--) {
    m_editList.removeIndex(selected[i]);
    lb->DeleteString(selected[i]);
  }
}
void CChangeOrderDlg::OnSelchangeEditlist() {
  CListBox *lb = getListBox();
  int i = lb->GetCurSel();
  if(i == lb->GetCount()-1) { // never select the last empty String
    lb->SetSel(lb->GetCount() - 1, false);
  }
}
示例#10
0
void COutputWnd::AdjustHorzScroll(CListBox& wndListBox)
{
	CClientDC dc(this);
	CFont* pOldFont = dc.SelectObject(&afxGlobalData.fontRegular);

	int cxExtentMax = 0;

	for (int i = 0; i < wndListBox.GetCount(); i ++)
	{
		CString strItem;
		wndListBox.GetText(i, strItem);

		//cxExtentMax = max(cxExtentMax, dc.GetTextExtent(strItem).cx);
		
		// Just Ignore the min/max macro stuff
		if (cxExtentMax >= dc.GetTextExtent(strItem).cx)
		{
			cxExtentMax = cxExtentMax;
		} 
		else
		{
			cxExtentMax = dc.GetTextExtent(strItem).cx;
		}
	}

	wndListBox.SetHorizontalExtent(cxExtentMax);
	dc.SelectObject(pOldFont);
}
BOOL CExpressionTreeDlg::OnInitDialog() {
  __super::OnInitDialog();

  m_treeCtrl.substituteControl(this, IDC_TREE_EXPRESSION);

  m_layoutManager.OnInitDialog(this);
  m_layoutManager.addControl(IDC_TREE_EXPRESSION  , RELATIVE_SIZE );
  m_layoutManager.addControl(IDCLOSE              , RELATIVE_X_POS);
  m_layoutManager.addControl(IDC_CHECKEXTENDEDINFO, RELATIVE_X_POS);
  m_layoutManager.addControl(IDC_LIST_SYMBOLTABLE , RELATIVE_Y_POS | RELATIVE_WIDTH);

  m_treeCtrl.showTree(m_node, m_extendedInfo);

  const String treeFormName = m_expr.getTreeFormName();
  const String stateName    = m_expr.getStateName();
  const int    nodeCount    = m_expr.getNodeCount();

  String title = getWindowText(this);
  title += format(_T(" - %s form - state %s. %d nodes")
                 ,treeFormName.cstr()
                 ,stateName.cstr()
                 ,nodeCount
                 );
  setWindowText(this, title);

  CListBox *lb = (CListBox*)GetDlgItem(IDC_LIST_SYMBOLTABLE);
  const ExpressionVariableArray variables = m_expr.getSymbolTable().getAllVariables();
  for(size_t i = 0; i < variables.size(); i++) {
    const ExpressionVariableWithValue &v = variables[i];
    lb->InsertString(-1, v.toString().cstr());
  }
  return TRUE;
}
示例#12
0
void DisplayDMOTypeInfo(const GUID *pCLSID, 
                        ULONG& ulNumInputsSupplied,  CListBox& ListInputTypes,
                        ULONG& ulNumOutputsSupplied, CListBox& ListOutputTypes)
{
    const int NUM_PAIRS=20;
    HRESULT hr;
    DMO_PARTIAL_MEDIATYPE aInputTypes[NUM_PAIRS]={0}, 
                          aOutputTypes[NUM_PAIRS]={0};
    ULONG ulNumInputTypes=NUM_PAIRS, ulNumOutputTypes=NUM_PAIRS, i;
    TCHAR szCLSID[128];

    // Read type/subtype information
    hr = DMOGetTypes(
        *pCLSID,
        ulNumInputTypes,  &ulNumInputsSupplied,  aInputTypes,
        ulNumOutputTypes, &ulNumOutputsSupplied, aOutputTypes);

    if (FAILED(hr))
        return;

    // Show input type/subtype pairs
    for (i=0; i<ulNumInputsSupplied; i++)
    {
        GetTypeSubtypeString(szCLSID, aInputTypes[i]);
        ListInputTypes.AddString(szCLSID);
    }

    // Show output type/subtype pairs
    for (i=0; i<ulNumOutputsSupplied; i++)
    {
        GetTypeSubtypeString(szCLSID, aOutputTypes[i]);
        ListOutputTypes.AddString(szCLSID);
    }
}
示例#13
0
HRESULT EnumDMOsToList(IEnumDMO *pEnumCat, CListBox& ListFilters, int& nFilters)
{
    HRESULT hr=S_OK;
    ULONG cFetched;
    WCHAR *wszName;
    CLSID clsid;

    // Clear the current filter list
    ClearFilterListWithCLSID(ListFilters);
    nFilters = 0;

    // If there are no filters of a requested type, show default string
    if (!pEnumCat)
    {
        ListFilters.AddString(TEXT("<< No entries >>"));
        return S_FALSE;
    }

    // Enumerate all items associated with the moniker
    while(pEnumCat->Next(1, &clsid, &wszName, &cFetched) == S_OK)
    {
        nFilters++;
        CString str(wszName);

        // Add filter's name and CLSID to the list box
        AddFilterToListWithCLSID(str, &clsid, ListFilters);
        CoTaskMemFree(wszName);
    }

    // If no DMOs matched the query, show a default item
    if (nFilters == 0)
        ListFilters.AddString(TEXT("<< No entries >>"));

    return hr;
}
void CFirstFollowDlg::OnEnChangeBrowseOpen()
{
	// TODO:  如果该控件是 RICHEDIT 控件,它将不
	// 发送此通知,除非重写 CDialogEx::OnInitDialog()
	// 函数并调用 CRichEditCtrl().SetEventMask(),
	// 同时将 ENM_CHANGE 标志“或”运算到掩码中。

	// TODO:  在此添加控件通知处理程序代码

	CString path;
	GetDlgItemText(IDC_BROWSE_OPEN,path);
	if(path.GetLength() == 0) return;
	SetDlgItemText(IDC_BROWSE_OPEN,_T(""));

	this->OnBnClickedButtonClear();

	StreamHelper::getStreamFromFileStream( this->productionList, this->orignProductions, path.GetBuffer(0));

	CListBox *listBox = (CListBox*) GetDlgItem(IDC_LIST_PROD);

	for (size_t i=0;i<this->orignProductions.size();i++)
	{
		listBox->AddString(this->orignProductions[i].c_str());
	}
}
示例#15
0
void CFuncDialog::OnOK() 
{
    CListBox* pList = (CListBox*)GetDlgItem(IDC_FUNCLIST);
    pList->GetText(pList->GetCurSel(), m_current);
	
	CDialog::OnOK();
}
示例#16
0
void CSpellingDialog::OnSelchangeSuggestions() 
{
	// Stick the selected word in the "change to" edit.

	CListBox* pList = (CListBox*)GetDlgItem(IDC_SUGGESTIONS);
	CEdit* pEdit = (CEdit*)GetDlgItem(IDC_CHANGE_TO);
	CString csText;

	if (pEdit != NULL)
	{
		if (pList != NULL)
		{
			TRY
			{
				int nCurSel = pList->GetCurSel();
				if (nCurSel >= 0)
				{
					pList->GetText(nCurSel, csText);
				}
			}
			END_TRY
		}
		// Set the text.
		BOOL fInnerSet = m_fInnerSet;
		m_fInnerSet = TRUE;
		pEdit->SetWindowText(csText);
		m_fInnerSet = fInnerSet;
	}
示例#17
0
void CListDlg::OnOK()
{
	CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LISTDIALOG_LIST);
	ASSERT(pListBox != NULL);
	m_nSelection = pListBox->GetCurSel();
	CDialog::OnOK();
}
示例#18
0
BOOL CAdministrativePage::OnInitDialog() 
{
	CNewWizPage::OnInitDialog();
	
	GetDlgItem(IDC_PORTALADMINISTRATIVE_TITLE)->SetFont(&((CPTKInstallerDlg*)GetParent())->m_fontTitle, TRUE);

	CWizardData* pWizardData = ((CPTKInstallerDlg*)GetParent())->m_pWizardData;

	CListBox* lstLanguages = (CListBox*)GetDlgItem(IDC_PORTAL_LANGUAGES);

	//load languages
	CString strBuf;
	for (int i=0;i < pWizardData->m_arrLanguagesNames.GetSize();i++)
	{
		strBuf.Format("%s [%s]", pWizardData->m_arrLanguagesNames.ElementAt(i), pWizardData->m_arrLanguagesCodes.ElementAt(i));
		lstLanguages->AddString(strBuf);
	}

	GetDlgItem(IDC_PORTAL_MAILSERVERNAME)->SetWindowText(pWizardData->m_strMailServerName);
	strBuf.Format("%d", pWizardData->m_nMailServerPort);
	GetDlgItem(IDC_PORTAL_MAILSERVERPORT)->SetWindowText(strBuf);
	GetDlgItem(IDC_PORTAL_DEFAULTFROMADDRESS)->SetWindowText(pWizardData->m_strDefaultFromAddress);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
示例#19
0
bool CNewsHubDlg::Message(const NewsHub::Socket & socket, const unsigned int messageId, const std::string & message)
{
  CListBox* pReceivedMessages = (CListBox*)GetDlgItem(IDC_RECEIVED_MESSAGES);
  CString str;

  if (socket.Type() == "TCP")
  {
    std::string from, to;
    int fromPort, toPort;
    NewsHub::TcpSocket* tcpSocket = (NewsHub::TcpSocket*)&socket;
    tcpSocket->SockAddr(to, toPort);
    tcpSocket->PeerAddr(from, fromPort);
    str.Format(_T("(From: %s:%d to: %s:%d msgId:%d): %s"), 
      CString(from.c_str()), fromPort, CString(to.c_str()), toPort, messageId, CString(message.c_str()));
  }
  else
  {
    str.Format(_T("%d: %s"), messageId, CString(message.c_str()));
  }

  int row = pReceivedMessages->AddString(str);
  pReceivedMessages->SetCurSel(row);

  CButton* pSendDeliveryConfirmation = (CButton*)GetDlgItem(IDC_SEND_DELIVERY_CONFIRMATION);
  return pSendDeliveryConfirmation->GetCheck() == BST_CHECKED;
}
示例#20
0
void CFanmotorDlg::OnBnClickedButtonStart()
{
	CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
    listBoxBridges->SetCurSel(0);
	
	//setpower5v();
	setspeed400k();
	
		
	/*success = 0;
	// Initialize USB
	use_debugdlg_main.InitUSB();
	if (success){
		// Initialize FPGA with our configuration bitfile.
		use_debugdlg_main.InitFPGA();
		if (success){
			// Initialize PLL
			use_debugdlg_main.InitPLL();
			success = 1;

			pwm_dc=(pwm_period*duty_cycle1)/100;
			pwm_in = (pwm_dc<<5)+(pwm_freq<<2)+sclk_freq;
			okUsbFrontPanel_SetWireInValue(use_debugdlg_main.xem, 0x03, pwm_in, 0xffff);// choose SCLK
			okUsbFrontPanel_SetWireInValue(use_debugdlg_main.xem, 0x04, pwm_on_mod, 0x001f);// choose PWM_IN
	        okUsbFrontPanel_UpdateWireIns(use_debugdlg_main.xem);
	        Sleep(1);
		}
	}*/
}
示例#21
0
//=====================================================================================
//  Window for WIND
//=====================================================================================
CFuiWind::CFuiWind(Tag idn, const char *filename)
:CFuiWindow(idn,filename,0,0,0)
{ char erm[128];
  sprintf(erm,"Incorrect TEMPLATE file: %",filename);
  //---Locate components ------------------------------------
  layW = (CFuiList*)  GetComponent('layr');
  if (0 == layW) gtfo(erm);
  errW = (CFuiLabel*) GetComponent('eror');
  if (0 == layW) gtfo(erm);
  popW = (CFuiPopupMenu*) GetComponent('popm');
  if (0 == popW) gtfo(erm);
  skyW = (CFuiTextField*) GetComponent('ceil');
  if (0 == skyW) gtfo(erm);
  //-- Init menu -------------------------------------------
  popW->CreatePage(&cMEN,coverMENU);
  layer = globals->wtm->GetCloudLayer();
  popW->SetButtonText((char*)cMEN.aText[layer]);
  //-- Init cloud ceil -------------------------------------
  ceil = globals->wtm->GetCloudCeil();
  ChangeCeil(0);
  //-- Init list box ---------------------------------------
  U_INT type = LIST_HAS_TITLE + LIST_NOHSCROLL;
  windBOX.SetParameters(this,'layr',type);
  windBOX.Display();
  Select();
}
示例#22
0
文件: project.cpp 项目: AmziLS/apls
void CProjectView::OnFileadd() 
{
   // Start in the project directory
   ((CProjectDoc*)GetDocument())->SetProject();
   _TCHAR* FileBuffer = new _TCHAR[4096];

   CFileDialog *pfileDlg = NULL;

   if (g_osrel >= 4)
   {
      pfileDlg = new CFileDialog(TRUE, NULL, NULL,
         OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT|OFN_EXPLORER,
         _T("Prolog Files (*.pro;*.plm)|*.pro;*.plm|All (*.*)|*.*||"));
   }
   else
   {
      pfileDlg = new CFileDialog(TRUE, NULL, NULL,
         OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT,
         _T("Prolog Files (*.pro;*.plm)|*.pro;*.plm|All (*.*)|*.*||"));
   }

   pfileDlg->m_ofn.lpstrFile = FileBuffer;
   FileBuffer[0] = EOS;  // Note, must do this or W95 flags as error
   pfileDlg->m_ofn.nMaxFile = 4096;

   if (pfileDlg->DoModal() != IDOK)
   {
      //_TCHAR errbuf[512];
      //wsprintf(errbuf, _T("FileDialog error: %d"), CommDlgExtendedError());
      //AfxMessageBox(errbuf);
      delete pfileDlg;
      return;
   }

   CListBox* pLB = (CListBox*)GetDlgItem(IDP_FILELIST);

   // Loop through all the files to be added. If they are in the project
   // directory or below, just put in the relative path.
   POSITION pos = pfileDlg->GetStartPosition();
   CString dir(m_directory), path, upath;
   dir.MakeUpper();
   int i, idx;
   while (pos != NULL)
   {
      path = pfileDlg->GetNextPathName(pos);
      upath = path;
      upath.MakeUpper();
      if (dir.Right(1) != _T("\\"))
         dir = dir + _T("\\");
      i = upath.Find(dir);
      if (i >= 0)
         path = path.Mid(i+dir.GetLength());
      idx = pLB->AddString(path);
      update_scroll(pLB, path); 
   }
   delete FileBuffer;
   delete pfileDlg;

   ((CProjectDoc*)GetDocument())->SetProject();
}
示例#23
0
//TCP接收数据处理函数
LONG CTCPServerDlg::OnRecvTCPData(WPARAM wParam,LPARAM lParam)
{
	DATA_BUF *pGenBuf = (DATA_BUF*)wParam; //通用缓冲区
	CTCPCustom_CE* pTcpCustom= (CTCPCustom_CE* )lParam; //TCP客户端对象
	//接收显示列表
	CListBox * pLstRecv = (CListBox*)GetDlgItem(IDC_LST_RECV);
	ASSERT(pLstRecv != NULL);
	//接收到的数据
	CString strRecv;
	CString strLen;
	strLen.Format(L"%d",pGenBuf->dwBufLen);
	strRecv = CString(pGenBuf->sBuf);
	
	pLstRecv->AddString(_T("************************************"));
	pLstRecv->AddString(_T("来自: ") + CString(pGenBuf->szAddress) );
	pLstRecv->AddString(_T("数据长度:")+strLen);
	pLstRecv->AddString(strRecv);

	//发送回应命令
	if (!m_tcpServer.SendData(pTcpCustom,"recv ok",strlen("recv ok")))
	{
		AfxMessageBox(_T("发送失败"));
	}

	//释放内存
	delete[] pGenBuf->sBuf;
	pGenBuf->sBuf = NULL;
	delete pGenBuf;
	pGenBuf = NULL;
	return 0;
}
示例#24
0
文件: project.cpp 项目: AmziLS/apls
void CProjectView::OnLibdel() 
{
   int nItem;
   CListBox* pLB = (CListBox*)GetDlgItem(IDP_LIBLIST);
   nItem = pLB->GetCurSel();
   pLB->DeleteString(nItem);
}
示例#25
0
void KG3DAnimationContainer::FillAnimationList(CListBox& ListBox, enuFillListBoxType Type)
{
    ListBox.ResetContent();
    LPCTSTR pszName = NULL;
    for(int i = 0; i < static_cast<int>(m_Clips.size()); i++)
    {

        switch(Type)
        {
        case ENUM_FILL_WITH_ANINAME:
        {
            m_Clips[i]->GetName(&pszName);
            ListBox.InsertString(i, pszName);
            ListBox.SetItemData(i, reinterpret_cast<DWORD_PTR>(m_Clips[i]));
            break;
        }
        case ENUM_FILL_WITH_FILENAME:
        {
            m_Clips[i]->GetPathName(&pszName);
            ListBox.InsertString(i, pszName);
            ListBox.SetItemData(i, reinterpret_cast<DWORD_PTR>(m_Clips[i]));
            break;
        }
        }
    }
}
示例#26
0
文件: project.cpp 项目: AmziLS/apls
CString CProjectDoc::GetLib(int i)
{
   CString sLib;
   CListBox* pLB = (CListBox*)GetProjectView()->GetDlgItem(IDP_LIBLIST);
   pLB->GetText(i, sLib);
   return sLib;
}
示例#27
0
文件: mainmenu.cpp 项目: paud/d2x-xl
static void PlayMenuSong (void)
{
	int				h, i;
	CStack<char*>	m (MAX_NUM_SONGS + 2);
	CFile				cf;
	char				szSongTitles [2][14] = {"- Descent 2 -", "- Descent 1 -"};
	CListBox			lb;

m.Push (szSongTitles [0]);
for (i = 0; i < songManager.TotalCount (); i++) {
	if (cf.Open (reinterpret_cast<char*> (songManager.SongData (i).filename), gameFolders.szDataDir, "rb", i >= songManager.Count (0))) {
		cf.Close ();
		if (i == songManager.Count (0))
			m.Push (szSongTitles [1]);
		m.Push (songManager.SongData (i).filename);
		}
	}
for (;;) {
	h = lb.ListBox (TXT_SELECT_SONG, m);
	if (h < 0)
		return;
	if (!strstr (m [h], ".hmp"))
		continue;
	for (i = 0; i < songManager.TotalCount (); i++)
		if (songManager.SongData (i).filename == m [h]) {
			songManager.Play (i, 0);
			return;
			}
	}
}
示例#28
0
void SetWidthByContentInListBox(CDialog* pDlg, int nID)
{
	if (nID <= 0|| pDlg == NULL) return;
	CWnd* pWnd = (CWnd*)pDlg;

	CListBox* pCB = (CListBox*)pWnd->GetDlgItem(nID);
	if (pCB == NULL) return;

	int origSize = pCB->GetHorizontalExtent();
	int maxSize = origSize;

	CDC* pDC = pWnd->GetDC();
	CString cStr;
	int str_num = pCB->GetCount();
	for (int i = 0; i < str_num; i++)
	{
		pCB->GetText(i, cStr);

		CSize strSize = pDC->GetOutputTextExtent(cStr);
		if (strSize.cx > maxSize)
			maxSize = strSize.cx;
	}

	// in case when adding to list, existing items may be
	// longer than newer ones, so may not want to resize
	if (maxSize > origSize)
		pCB->SetHorizontalExtent(maxSize);
}
示例#29
0
/**************************************************************************************
    Function Name    :  SetHorizExtentListBox
    Input(s)         :  CListBox& omListBox
    Output           :  void
    Functionality    :  Sets the Listbox scroll to an extent so as to view the longest
                        string that is inserted.
    Member of        :  CExploreMsgSg
    Author(s)        :  Robin G.K.
    Date Created     :  27.10.2015
    Requirement ID   :  RS_FLX_08_09_10
***************************************************************************************/
void  CExploreMsgSg::SetHorizExtentListBox(CListBox& omListBox)
{
    // Set horizontal extent of the list
    // box to max string availaable
    // so that user can scroll
    CSize   sz;
    CString omStrText;
    CDC*  pDC = omListBox.GetDC();
    if ( pDC != nullptr)
    {
        int nDx = 0;
        for (int nCount = 0;
                nCount < omListBox.GetCount();
                nCount++)
        {
            omListBox.GetText( nCount, omStrText );
            // remove space
            omStrText.TrimRight();
            sz = pDC->GetTextExtent(omStrText);
            if (sz.cx > nDx)
            {
                nDx = sz.cx;
            }
        }
        omListBox.ReleaseDC(pDC);
        // Set the horizontal extent so every character of all
        // strings can be scrolled to.
        omListBox.SetHorizontalExtent(nDx);
    }
}
示例#30
0
文件: test.cpp 项目: darwinbeing/NHD2
void CTestMenu::testCListBoxDetailsTitleInfo()
{
	CListBox * listBox = new CListBox("listBoxDetailsTitleInfo", w_max ( (CFrameBuffer::getInstance()->getScreenWidth() / 20 * 17), (CFrameBuffer::getInstance()->getScreenWidth() / 20 )), h_max ( (CFrameBuffer::getInstance()->getScreenHeight() / 20 * 16), (CFrameBuffer::getInstance()->getScreenHeight() / 20)), true, true, true);
	
	listBox->exec(NULL, "");
	delete listBox;
}