469,946 Members | 1,782 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,946 developers. It's quick & easy.

C++/CLI Realtime Data intensive Application

Hello

I have created a realtime data intensive application in C++/CLI. Data
streams into this application through a set of ActiveX controls. For
example, each stock symbol will be assigned to one of these controls and
the symbol will be updated through one of the events of these controls.

Symbols and their corresponding data are displayed in a listview. Data
is updated few times a second per symbol.

Unfortunately I have encountered several problems:

1) CPU utilization of this app is quite high for a sustained period of
time. Utilization of up to 100% is often seen for close to a minute at
a time.

2) The ever nagging Listview flickering problem which is constant due to
the rapid data updates.

Below is the relevant fragment of code. Is the basic use of delegates
correct? Is there any way to avoid the flicker? BeginUpdate and
EndUpdate make the app unusable!

Any general or specific hint or help is greatly appreciated.

Regards

---------------------------------------

public ref class Form1 : public System::Windows::Forms::Form
{

private: delegate System::Void
UpdateListViewDelegate(System::Collections::Hashta ble ^map);

private: System::Void UpdateListView(System::String ^symbol,
System::Collections::Hashtable ^map)
{
if(listView1->InvokeRequired == false)
{
System::Windows::Forms::ListViewItem ^item =
listView1->FindItemWithText(symbol);

System::Collections::IEnumerator^ myEnum =
map->GetEnumerator();

while(myEnum->MoveNext())
{
System::Collections::DictionaryEntry ^de =
dynamic_cast<DictionaryEntry^>(myEnum->Current);

System::String ^key =
dynamic_cast<System::String^>(de->Key);
System::String ^value =

dynamic_cast<System::String^>(de->Value);

int index = FindColunmIndexDu(key);

item->SubItems[index]->Text = value;

item->SubItems[index]->BackColor = Color::Lime;

item->UseItemStyleForSubItems = false;
}
else
{
UpdateListViewDelegate ^UpdateLstDeleg =
gcnew UpdateListViewDelegate(this,
&Form1::UpdateListView);

this->BeginInvoke(UpdateLstDeleg,
gcnew cli::array<Object^>{symbol,map});
}
}
}

private: System::Void TRecordSet_DataChange(System::Object^ sender,
DataChangeEvent^ e)
{
TRecordSet ^obj = safe_cast<TRecordSet^>(sender);

System::Collections::Hashtable ^hash = gcnew
System::Collections::Hashtable();

hash->Add("Open", obj->GetOpenStr());
hash->Add("High", obj->GetHighStr());
...
...
...
UpdateListView(obj->GetSymbolStr(), hash);
}

}

}
Nov 17 '05 #1
0 950

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Rafał | last post: by
6 posts views Thread by aikwee | last post: by
4 posts views Thread by malv | last post: by
reply views Thread by noxs | last post: by
4 posts views Thread by =?Utf-8?B?YXVsZGg=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.