|
hello,
In 1st, i used a Timer, who get a packets every tick, but my application became heavy, for this reason i would use a Thread.
With Timer:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {<br />
timer5->Interval=10;<br />
timer5->Start();<br />
}<br />
<br />
private: System::Void timer5_Tick(System::Object^ sender, System::EventArgs^ e) {<br />
<br />
While (there are packets which arrive ) {<br />
<br />
listView->Items->add (one paquets)<br />
<br />
}
Witht Thread { an exception on listView }
delegate void DelegateThreadTask();<br />
DelegateThreadTask ^ er;<br />
<br />
<br />
<br />
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {<br />
Threading::Thread(gcnew ThreadStart(this, &Form1::Traitement));<br />
t->Start();<br />
<br />
}<br />
.<br />
.<br />
.<br />
<br />
void Traitement( )<br />
{ while(true)<br />
{ThreadTask();<br />
Thread::Sleep(100); <br />
}<br />
<br />
}<br />
.<br />
.<br />
.<br />
void ThreadTask() <br />
{<br />
<br />
While (there are packets which arrive ) {<br />
<br />
listView->Items->add (one packets)<br />
<br />
}<br />
<br />
er = gcnew DelegateThreadTask(this, &Form1::ThreadTask);<br />
er->Invoke(); }<br />
<br />
<br />
<br />
Please hlep me,to get packets without heavy my système
Thank you verry mutch
|
|
|
|
|
Hi,
abbd wrote: listView->Items->add (one packets)
this probably is the offending line. As I explained before, a thread other than
the GUI thread is not allowed to do this, lictView belongs to the GUI thread.
Read up on InvokeRequired and Invoke(); you will need a delegate.
|
|
|
|
|
I make this:
delegate void DelegateThreadTask();<br />
.<br />
.<br />
.<br />
<br />
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {<br />
Threading::Thread(gcnew ThreadStart(this, &Form1::Traitement));<br />
t->Start();<br />
<br />
}<br />
.<br />
.<br />
.<br />
<br />
void Traitement( )<br />
{ while(true) {ThreadTask();Thread::Sleep(100);}<br />
<br />
}<br />
<br />
<br />
void ThreadTask() <br />
{listView2->Items->Add("zezeze");<br />
<br />
DelegateThreadTask ^ er = gcnew DelegateThreadTask(this, &Form1::ThreadTask);<br />
Invoke(er); <br />
}
but always there are an exception
how i can resolve this great problem
Thank you very mutch.
|
|
|
|
|
You did it again: what exception ?
anyhow I gave you the keywords, the suggestion to read some article,
and an example (in C#). I dont speak C++, I cant help you any further.
Bonne chance.
|
|
|
|
|
Hi,
i do this
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {<br />
oa[0] = sender;<br />
oa[1] = e;<br />
<br />
<br />
Thread ^th = gcnew Thread(gcnew ThreadStart(this, &Form1::Traitement));<br />
th->Start();<br />
<br />
<br />
}<br />
.<br />
.<br />
.<br />
this->Invoke(gcnew DelegateThreadTask(this,&BHIDS00::Form1::ThreadTask), oa);
but unfortunately, there are always exception, he show me line of
this->Invoke(gcnew DelegateThreadTask(this,&BHIDS00::Form1::ThreadTask), oa);
Thank you verry mutch
|
|
|
|
|
Hello All,
Although there is a wizard-generated AssemblyInfo.cpp file in my project, containing the default versioning directive:
[assembly:AssemblyVersionAttribute("1.0.*")]; ,
the generated assembly does not contain the version info resource (i.e. it does not get displayed as a tab in explorer's file properties).
I tried adding VersionInfo resource manually, but it uses hardcoded data, not the ones that are dynamically generated from the AssemblyInfo.cpp file.
How to set up a C++/CLI class library project to automatically include the appropriate version info?
|
|
|
|
|
Strange enough this seems to work fine if you use the C# compiler (the version information is included in the dll correctly) but the C++ compiler still needed the old-style RC, call it versioninfo.rc for instance.
There is an example of such a resource file at:
http://msdn2.microsoft.com/en-us/library/aa381058.aspx[^]
A problem that i have not solved is how to get the version from AssemblyInfo.cpp into the native resource-file.
A workaround i'm using now is: create a new file version.h the contains the version numbers and include it in both versioninfo.rc and AssemblyInfo.cpp.
Gr,
Jan
|
|
|
|
|
Hi, I am using Visual Studio 2005 C++/CLI. I was just curious about something. When I am 'using namespace System::Drawing' and I want to display some text on the screen I have the following two lines to setup my brush and font...
SolidBrush^ blackBrush = gcnew SolidBrush(Color::Black);
System::Drawing::Font^ myFont = gcnew System::Drawing::Font("Ariel", 16);
If I don't include System::Drawing:: in front of font, then this will not compile. If SolidBrush and Font are both classes in the System::Drawing namespace why do I have to include (for lack of a better term) the full path of the Font class? What makes the Font class different?
Thanks
Buck
|
|
|
|
|
Hello Buck,
This is because Font is most probably also a member (a property) of the class you are editing (perhaps a Control- derived class).
|
|
|
|
|
BuckBrown wrote: "Ariel"
In addition to BB's reply...
You may want to use "Arial"
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, I am using Visual Studio 2005 C++/CLI. I was just curious about something. When I am 'using namespace System::Drawing' and I want to display some text on the screen I have the following two lines to setup my brush and font...
SolidBrush^ blackBrush = gcnew SolidBrush(Color::Black);
System::Drawing::Font^ myFont = gcnew System::Drawing::Font("Ariel", 16);
If I don't include System::Drawing:: in front of font, then this will not compile. If SolidBrush and Font are both classes in the System::Drawing namespace why do I have to include (for lack of a better term) the full path of the Font class? What makes the Font class different?
Thanks
Buck
|
|
|
|
|
Hi all,I am having some problems with the OpenEx functin,the probelm is I don't know how to formulate the connection string.I've been using:
CDatabase con;
con.Open(_T( "DSN=;UID=sa" ),CDatabase::openReadOnly |CDatabase::noOdbcDialog );
But where do we pass the server name and the password?The program haults with an exception,this is my first application using afxdb and CDatabase,thanks in advance.
|
|
|
|
|
First, you're in the wrong forum if you're not using Managed C++/CLI.
Connection strings vary, depending on the ODBC driver you're using, and are generally documented
somewhere.
For example, when using the SQL Native Client for SQL Server, there's:
Using Connection String Keywords with SQL Native Client[^]
Also, CDatabase and related classes use exceptions for error handling. You'll probably want to catch
those exceptions and at least examine them - they provide fairly detailed error info from the ODBC
driver.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am sorry,in my haste to post the question I posted it in the wrong form,I am using the .net frame work to create a visual C++ windows from application. I didn't want to use the sql adapter thing, i wanted to creat a connection the old fashioned way using cdatabase and afxdb.I am using sql server 2000 and thats what i want to connect to.Frankly I haven't had much time to research this at all,I was checking out this site and thought I might try it,I thank you all for your help and time.
|
|
|
|
|
CodeMaster_05 wrote: I am sorry,in my haste to post the question I posted it in the wrong form,
No problem! Everyone gets one chance...
Did you find the connection string info you needed? I used to have it for SQL Server 2000 but I
can't find it....I'll let you know if I do.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually, it looks like the link I posted applies to 2000 as well (when using the native client).
Make sure you scroll down to the ODBC section
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks alot,it works perfectly, you people are great. Best regards
|
|
|
|
|
Hi
I'm trying to let my application run another application and give it write permission. At the moment i'm using CreateProcess, but can't figure out how to grant the process write permissions..
Tried googling alot, but can't find too many examples.. =/
Can anyone help me..?
Thanks!
|
|
|
|
|
I want to read data from a hardware device like time access punching machine.
What is the complete process to read data and storing into a databse from any hardware device.
If any one have some idea, please guide me.
Thanks,
Pathak
|
|
|
|
|
pathak78 wrote: What is the complete process to read data and storing into a databse from any hardware device.
Like so? (Pseudocode)
do
Read the data from the hardware's interface
Append to your database
until exit
Failure is not an option - it's built right in.
|
|
|
|
|
Reference types(ref class/struct) only supports public inheritance.
ref class Base{};
ref class Derived1 : public Base{};
ref class Derived2 : private Base{}
ref class Derived3 : protected Base{}
Why C++/CLI doesn't support private and protected inheritance?
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Because it only supports what .NET supports.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
vibindia wrote: Why C++/CLI doesn't support private and protected inheritance?
I have a better question for you. What makes "so called software developers" think they can develop software using technology and tools that they don't know anything about because they have never read the freakin documentation?
|
|
|
|
|
I give up....what?
Sorry, I thought it was a riddle. Oh wait, it IS a riddle...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
i would use an array of string with every fields of this array was an other array of string, i try for
array < String ^ > ^ tab=gcnew array < String ^ > (200);
tab2 tab[20];
But unfortunatly there are error
Thank you verry mutch
|
|
|
|