CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Jan 2009

    RTD server and Excel


    Incorrect Forum sorry

    I downloaded the dummy example VCRTDServer to create a RTD server. It works fine. However I obviously want to do a bit more than just display current time.

    The idea is that I have have realtime data from a 3rd part app and I want to be able to retrieve it in excel in realtime.

    First I have conceptual questions:

    - Each call to RefreshData() method is supposed to contain the info to refresh all my topics even those that haven't changed?
    - What is RealTimeDataThread() supposed to do except setting the timers?

    Basically what I have done is I write my external data in a txt file every time there is a refresh, then the RefreshData() method updates for each topic in the topic list with the data from that flat file.
    Is it how things should be done? What other way is fast enough to deal with several possible refresh per seconds? XML? SQL? Below is what I am trying... I didn't find any example on google where basically the data to be refreshed is to be obtained somewhere else... all I found is systime or random numbers...

    Finally, I have experienced some rather odd behavior when this runs in Excel. Most of the time the cells are refreshed with the correct data but sometimes topics get for a fraction of second data that belong to another topic I believe. I cannot figure out what is wrong. Have you experienced this and know how to solve it? Same when I delete a topic, I suspect the unsubscribing method is not correct (?)

    thank you for your help!

    		std::fstream fileData(sPathFile.c_str(),std::ios::in);
    		string ligne;
                    int size = m_pTopicList->Size(); 
    		int TID = 0;
    		char_separator<char> sep("|",0,boost::keep_empty_tokens);
    		timer t0;
    //#pragma omp parallel shared(size,parrayOut  ) private(i, t0, strLine, ligne,value,valBuffer,index )
    //#pragma omp for
    		for(int i=0; i< size; i++){
    			string ligne;
    			fileData.seekg(0, fstream::beg);
    			TID = omp_get_thread_num();
    			while(getline(fileData, ligne))  
    				typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
    				boost::char_separator<char> sep("|");
    				tokenizer tokens(ligne, sep);
    				tokenizer::iterator tok_iter= tokens.begin();
    				if (*tok_iter==m_vTickerList[i]){
    					if (*tok_iter==m_vBID_ASKList[i]){
    						strLine= *tok_iter;
    			if (strLine !=""){
    				std::wstring wsS(strLine.length(), L' '); // Make room for characters
    				// Copy string to wstring.
    				std::copy(strLine.begin(), strLine.end(), wsS.begin());
    				//Build a value to return
    				index[0] = 0;
    				index[1] = i;
    				value.vt = VT_I4;
    				value.lVal = m_pTopicList->Retrieve();
    				SafeArrayPutElement( *parrayOut, index, &value);
    				static WCHAR valBuffer[80];
    				swprintf( valBuffer, L"&#37;s",wsS.c_str());
    				index[0] = 1;
    				index[1] = i;
    				value.vt = VT_BSTR;
    				value.bstrVal = SysAllocString( valBuffer );
    				SafeArrayPutElement( *parrayOut, index, &value);
    				::VariantClear(& value);
    Last edited by lequocle; October 13th, 2011 at 02:47 PM. Reason: Incorrect Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.