Пример #1
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);
    }
}
Пример #2
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;
}
Пример #3
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;
}
Пример #4
0
void CBerkeleyView::OnBnClickedButton1()
{
	CString csDbFile;
	GetDlgItem(IDC_DB_FILE)->GetWindowTextW(csDbFile);

	if (!csDbFile.IsEmpty())
	{
		if (m_spDb.get() != NULL)
		{
			m_spDb->DestroyDb();
		}

		m_spDb.reset(new CDbLayer_Test());
		m_spDb->InitDb(csDbFile);

		CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_DATA_TYPE);
		m_spDb->SetDecoder((DataDecoder::DataEncodeType)pBox->GetItemData(pBox->GetCurSel()));

		CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST_DB_CONTENT);
		pList->ResetContent();

		std::vector<tstring> data = m_spDb->GetFirstData();
		if (data.size() > 0)
		{
			tstring line = _T("1 ");
			for(int i = 0; i < data.size(); ++i)
			{
				line.append(data[i].size() > 50 ? data[i].substr(0, 50) + _T("...") : data[i]);
				line.append(_T(" "));
			}

			pList->AddString(line.c_str());
		}

		int nLine = 1;
		data = m_spDb->GetNextData();
		while(nLine < 1000 && data.size() > 0)
		{
			CString csNum;
			csNum.Format(_T("%d "), nLine+1);
			tstring line = csNum;
			for(int i = 0; i < data.size(); ++i)
			{
				line.append(data[i].size() > 50 ? data[i].substr(0, 50) + _T("...") : data[i]);
				line.append(_T(" "));
			}

			pList->AddString(line.c_str());
			data = m_spDb->GetNextData();
			++nLine;
		}
	}
}
Пример #5
0
BOOL COptDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	// TODO: Add extra initialization here
	CListBox *pLB = (CListBox *)GetDlgItem(IDC_LST_BEGIN);
	CListBox *pLE = (CListBox *)GetDlgItem(IDC_LST_END);

	for(long i = 0 ;i<this->begs.GetSize(); i++)
	{
		pLB->AddString(begs[i]);
		pLE->AddString(ends[i]);
	}

    CMainFrame *pMain = (CMainFrame*)::AfxGetApp()->GetMainWnd();
    CTraDoc *pDoc = (CTraDoc*)pMain->GetActiveDocument();

    for (int i = 0; i < _countof(_afxPropSheetButtons); i++)
    {
        HWND hWndButton = ::GetDlgItem(pDoc->m_pSheet->m_hWnd, _afxPropSheetButtons[i]);
        if (hWndButton != NULL && (_afxPropSheetButtons[i] == ID_APPLY_NOW || _afxPropSheetButtons[i] == IDHELP))
        {
            ::ShowWindow(hWndButton, SW_HIDE);
            ::EnableWindow(hWndButton, FALSE);
        }
        else if (hWndButton != NULL)
        {
            CRect btnRt, sheetRt;
            ::GetWindowRect(hWndButton, &btnRt);
            ::GetWindowRect(pDoc->m_pSheet->m_hWnd, &sheetRt);

            CSize btnSz(100, 25);

            pDoc->m_pSheet->ScreenToClient(&btnRt);
            pDoc->m_pSheet->ScreenToClient(&sheetRt);

            btnSz.cx = (sheetRt.right - sheetRt.left) / 4;

            if (_afxPropSheetButtons[i] == IDOK)
            {
                ::MoveWindow(hWndButton, sheetRt.left + (sheetRt.right - sheetRt.left)/8, btnRt.top, btnSz.cx, btnSz.cy, false);
            }
            else if (_afxPropSheetButtons[i] == IDCANCEL)
            {
                ::MoveWindow(hWndButton, sheetRt.left + (sheetRt.right - sheetRt.left)*5/8, btnRt.top, btnSz.cx, btnSz.cy, false);
            }

        }
    }
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #6
0
HRESULT AddGraphFiltersToList (IGraphBuilder *pGB, CListBox& m_ListFilters) 
{
    HRESULT hr;
    IEnumFilters *pEnum = NULL;
    IBaseFilter *pFilter = NULL;
    ULONG cFetched;

    // Clear filters list box
    m_ListFilters.ResetContent();
    
    // Verify graph builder interface
    if (!pGB)
        return E_NOINTERFACE;

    // Get filter enumerator
    hr = pGB->EnumFilters(&pEnum);
    if (FAILED(hr))
    {
        m_ListFilters.AddString(TEXT("<ERROR>"));
        return hr;
    }

    // Enumerate all filters in the graph
    while(pEnum->Next(1, &pFilter, &cFetched) == S_OK)
    {
        FILTER_INFO FilterInfo;
        TCHAR szName[256];
        
        hr = pFilter->QueryFilterInfo(&FilterInfo);
        if (FAILED(hr))
        {
            m_ListFilters.AddString(TEXT("<ERROR>"));
        }
        else
        {
            USES_CONVERSION;

            // Add the filter name to the filters listbox
            lstrcpy(szName, W2T(FilterInfo.achName));
            m_ListFilters.AddString(szName);

            // Must release filter graph reference
            FilterInfo.pGraph->Release();
        }       
        pFilter->Release();
    }
    pEnum->Release();

    return hr;
}
Пример #7
0
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();
}
Пример #8
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
}
Пример #9
0
// fillSuggestionsList:
// Fill the suggestions list with suggestions for the current word.
void CSpellingDlg::fillSuggestionsList() {
	CWaitCursor busy;

	SSCE_CHAR problemWord[SSCE_MAX_WORD_SZ];
	GetDlgItemText(IDC_PROBLEMWORD, (TCHAR *)problemWord, sizeof(problemWord));

	const int maxSuggestions = 16;
	SSCE_CHAR suggestions[maxSuggestions * SSCE_MAX_WORD_SZ];
	SSCE_S16 scores[maxSuggestions];
    SSCE_Suggest(SSCE_GetSid(), problemWord, suggestionDepth,
      suggestions, sizeof(suggestions), scores, maxSuggestions);

	CListBox *suggestionsList = (CListBox *)GetDlgItem(IDC_SUGGESTIONSLIST);
	suggestionsList->ResetContent();
    for (const SSCE_CHAR *p = suggestions; *p != _T('\0');
	  p += lstrlen((TCHAR *)p) + 1) {
		suggestionsList->AddString((TCHAR *)p);
	}

    // Select the first suggestion and copy it to the Change To field.
    if (suggestionsList->GetCount() > 0) {
		suggestionsList->SetSel(0);
		CString word1;
		suggestionsList->GetText(0, word1);
		SetDlgItemText(IDC_CHANGETO, word1);
    }
}
Пример #10
0
void SettingsDlg::OnDeltaposSpinModify(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
	CListBox *listbox;
	CListBox *listbox2;
	listbox = (CListBox*)GetDlgItem(IDC_AUDIO_CODECS_ALL);
	listbox2 = (CListBox*)GetDlgItem(IDC_AUDIO_CODECS);
	if (pNMUpDown->iDelta == -1) {
		//add
		int selected = listbox->GetCurSel();
		if (selected != LB_ERR) 
		{
			CString str;
			listbox->GetText(selected, str);
			listbox2->AddString(str);
			listbox->DeleteString(selected);
			listbox->SetCurSel( selected < listbox->GetCount() ? selected : selected-1 );
		}
	} else {
		//remove
		int selected = listbox2->GetCurSel();
		if (selected != LB_ERR) 
		{
			CString str;
			listbox2->GetText(selected, str);
			listbox->AddString(str);
			listbox2->DeleteString(selected);
			listbox2->SetCurSel( selected < listbox2->GetCount() ? selected : selected-1 );
		}
	}
	*pResult = 0;
}
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());
	}
}
Пример #12
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;
}
Пример #13
0
/*
*函数介绍:线程执行过程
*入口参数: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;
}
Пример #14
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;
}
Пример #15
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;
}
Пример #16
0
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 );
		}
	}
}
Пример #17
0
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);
}
Пример #18
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);
}
Пример #19
0
void xSceneOpenDlg::OnFloderChanged()
{
    CListBox * listFloder = (CListBox *)GetDlgItem(IDC_SceneOpen_Floder);
    CListBox * listScene = (CListBox *)GetDlgItem(IDC_SceneOpen_Scene);

    while (listScene->GetCount())
        listScene->DeleteString(0);

    int isel = listFloder->GetCurSel();

    if (isel < 0)
        return ;

    CString strFloder;

    listFloder->GetText(isel, strFloder);

    ResourceGroup * rg = ResourceManager::Instance()->GetResourceGroup();

    Archive * ar = rg->GetArchive((LPCTSTR)strFloder);

    Archive::FileInfoVisitor v = ar->GetFileInfos();

    while (!v.eof())
    {
        const TString128 & filename = v.Cursor()->second.name;

        if (File::GetExternName(filename) == "scene")
        {
            listScene->AddString(filename.c_str());
        }

        ++v;
    }
}
Пример #20
0
void CSelectDialog::Initialize( CQueryBuilder* builder ) {
	CListBox* fieldList = (CListBox*)GetDlgItem( IDC_FIELDLIST );
	CListBox* chosenList = (CListBox*)GetDlgItem( IDC_CHOSENLIST );
	vector< string > fields = builder->GetFieldList();
	for ( int i=0; i<fields.size(); i++ ) {
		fieldList->AddString( fields[i].c_str() );
	}

	//( (CButton*)GetDlgItem( IDC_UPBUTTON ) )->EnableWindow( FALSE );
	//( (CButton*)GetDlgItem( IDC_DOWNBUTTON ) )->EnableWindow( FALSE );
	( (CButton*)GetDlgItem( IDC_BACKBUTTON ) )->EnableWindow( FALSE );

	vector<string> chosen = builder->GetSelect();
	for ( int j=0; j<chosen.size(); j++ ) {
		chosenList->AddString( chosen[j].c_str() );
	}
}
Пример #21
0
//----------------------------------------------------------------------
void MapSizeDlg::Init()
{
	CListBox* pListBox = (CListBox*)GetDlgItem( IDC_MAPSIZE );

	int index = pListBox->AddString( "60x60" );
	pListBox->SetItemData( index, 0 );

	index = pListBox->AddString( "80x80" );
	pListBox->SetItemData( index, 1 );

	index = pListBox->AddString( "100x100" );
	pListBox->SetItemData( index, 2 );

	index = pListBox->AddString( "120x120" );
	pListBox->SetItemData( index, 3 );

	pListBox->SetCurSel( mapSize );
}
Пример #22
0
/*
Function: clear(CListBox &dbox, CString &output)
Description: This function starts at the head of the linked list and begins taking each node one by
			one and enerting it's information and how it died in to the dead box, and then deleting
			the node, and returning it's memory to the heap. It does this untill it reaches the end.
PreCondition: Valid list box and output strings passed to function, and all links in the list of nodes
			works correctly. 
PostCondition: The result is all the nodes in the list are added, with information on how they died
			to the dead list, and then they are removed from the list and returned to memory, then 
			it outputs it success in deleting the nodes.
*/
void virus::clear(CListBox &dbox, CString &output)
{
	node* temp = head;
	node* temp2 = NULL;
    if((head!=NULL)&&(tail!=NULL))//only if there is stuff in the list
	{
	while(temp->next!=NULL)
	{	
		int bday=(2005-(temp->age));//for displaying birthday stuff
		int dday=2005;
		char birthday[6]="";
		char deathday[6]="";
		_itoa(bday,birthday,10);
		_itoa(dday,deathday,10);
		dbox.AddString(temp->name+" "+birthday+" - "+deathday);
		dbox.AddString("Death By: Armageddon");
		dbox.AddString("********************");
		temp2=temp->next;//advance to next node
		delete temp;//delete node
		temp=temp2;
	}
	if(tail!=NULL)//special case for last node in list
	{
		int bday=(2005-(tail->age));
		int dday=2005;
		char birthday[6]="";
		char deathday[6]="";
		_itoa(bday,birthday,10);
		_itoa(dday,deathday,10);
		dbox.AddString(tail->name+" "+birthday+" - "+deathday);
		dbox.AddString("Death By: Armageddon");
		dbox.AddString("********************");
		delete tail;
     }
	output="Armageddon successful";

    head=NULL;//reset nead pointer
	tail=NULL;//reset tail pointer
	}else
	{
		output="No Names Currently In Live List.";
	}

}
Пример #23
0
void CUserListDlg::RefreshUserList() {
	vector<string> userList = storage.GetUserList();
	CListBox* userListBox = (CListBox*)GetDlgItem( IDC_USERLIST );
	if ( userListBox ) {
		userListBox->ResetContent();
		for ( int i=0; i<userList.size(); i++ ) {
			userListBox->AddString( userList[i].c_str() );
		}
	}
}
Пример #24
0
void CLabelTypeDialog::BuildList(void)
{
	int nType = IsDlgButtonChecked(IDC_LABEL_TYPE_LASER)
						? CPaperInfo::PAPER_CutSheet
						: CPaperInfo::PAPER_Continuous;

	/*
	// Get the name to match.
	*/

	CString csOldName;
	if (m_pOldInfo != NULL)
	{
		csOldName = m_pOldInfo->GetName();
	}

	int nNewSel = 0;
	CListBox* pList;

	if ((pList = (CListBox*)GetDlgItem(IDC_LABEL_LIST)) != NULL)
	{
		pList->SetRedraw(FALSE);
		pList->ResetContent();
		int nLabels = m_List.Labels();
		for (int nLabel = 0; nLabel < nLabels; nLabel++)
		{
			CLabelData* pLabel = m_List.Label(nLabel);
			ASSERT(pLabel != NULL);
			if (pLabel != NULL && pLabel->Type() == nType)
			{
				int nIndex = pList->AddString(pLabel->GetName());
				if (nIndex >= 0)
				{
					pList->SetItemData(nIndex, (DWORD)pLabel);

					if (pLabel->GetName() == csOldName)
					{
						nNewSel = nIndex;
					}
				}
			}
		}

	/*
	// Set the initial entry as necessary.
	*/

		if (pList->GetCount() > 0)
		{
			pList->SetCurSel(nNewSel);
			OnSelchangeLabelList();
		}
		pList->SetRedraw(TRUE);
	}
}
static void setGroupListBoxValues(CListBox &GroupListBox, const CGroupList &GroupList) {
	GroupListBox.ResetContent();
	CGroupList::EConstIterator it;
	for (it = GroupList.Begin(); !it.IsDone(); it++) {
		CString tmpCStr;
		tmpCStr = _TEXT("[");
		tmpCStr += ((*it).m_Label);
		tmpCStr += _TEXT("] ");
		GroupListBox.AddString(tmpCStr);
	}
}
Пример #26
0
int CPreferences::ItrPreferencesTableRowsCallbackFn(sqlite3_stmt *statement, void *pUserData)
{
    UNREFERENCED_PARAMETER(pUserData);
	CListBox *listBox = (CListBox *)GetDlgItem(IDC_LIST_PREFERENCES);
	CString prefName =
		SystemUtils::UTF8ToUnicode((const char *)sqlite3_column_text(statement, Preferences_PreferenceName)).c_str();
	listBox->AddString(prefName);
	CComboBox *pComboBox((CComboBox *)GetDlgItem(IDC_COMBO_DEFPREF));
	pComboBox->AddString(prefName);
	return 0;
}
Пример #27
0
void CSystemTestDlg::OnBnClickedRefreshMatchList()
{
	CFileFind finder;
	CListBox* list = (CListBox*)GetDlgItem(IDC_MATCH_LIST);
	list->ResetContent();
	BOOL bWorking = finder.FindFile(TEXT("img\\match\\*.bmp"));
	while(bWorking) {
		bWorking = finder.FindNextFile();
		list->AddString(finder.GetFileName());
	}
	_out(TEXT("Refresh Match list done."));
}
Пример #28
0
void CSystemTestDlg::OnBnClickedRefreshImageList()
{
	CFileFind finder;
	CListBox* list = (CListBox*)GetDlgItem(IDC_IMAGE_LIST);
	list->ResetContent();
	BOOL bWorking = finder.FindFile(TEXT("img\\screenshot\\*.bmp"));
	while(bWorking) {
		bWorking = finder.FindNextFile();
		list->AddString(finder.GetFileName());
	}
	_out(TEXT("Refresh done."));
}
Пример #29
0
void CFuncDialog::UpdateItems()
{
    CListBox* pList = (CListBox*)GetDlgItem(IDC_FUNCLIST);
    int count = pList->GetCount();

    for(int i = 0; i < m_items->GetSize(); i++)
    {
        int e = pList->AddString(m_items->GetData()[i]);
    }
    pList->SetCurSel(0);
    pList->UpdateWindow();
}
Пример #30
0
void CSelectDialog::OnRemoveButtonClicked() {
	CListBox* fieldList = (CListBox*)GetDlgItem( IDC_FIELDLIST );
	CListBox* chosenList = (CListBox*)GetDlgItem( IDC_CHOSENLIST );
	for ( int i=chosenList->GetCount()-1; i>=0; i-- ) {
		if ( chosenList->GetSel( i ) ) {
			CString temp;
			chosenList->GetText( i, temp );
			fieldList->AddString( temp );
			chosenList->DeleteString( i );
		}
	}
}