|
NalBH wrote: I apologise if i am in the wrong forum.
Accepted. You should post here: Visual C++/MFC[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
Maybe you can try this one:
FILE *fp; //file handler
//open the file
fp = fopen(filename, "r"); //check for mode "rb" if binary
//read the file and save to buffer
i = 0;
while (fget(buffer[i], SIZE-1, fp) != NULL)
i++;
fclose(fp); //close the file
I have'nt compile it but this is the algorithm and steps.
Hope this will help.
dfdf
|
|
|
|
|
Hello
thanks for replying.But where is the array where the data file has been stored.Can i call fget(buffer[i], SIZE-1, fp ) again in my code.How can i call the data in the file.And is SIZE the size of the file.It has not been defined.i have this peace of code but it doesnt seems to work.
Please help
Thanks
Nal
|
|
|
|
|
Hi,
What does mean
- the easy way is have every Control be handled by the GUI thread, which
could mean, use a Forms.Timer, since that executes its Tick handler on the
GUI thread. The drawback is, if the Tick handler takes too long, your GUI
responsiveness will suffer
i have an exception when i use listview whith thread:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
Additional information: Cross-thread operation not valid: Control 'listView2' accessed from a thread other than the thread it was created on.
Please help me de resolve this great problem,
Thank you,
|
|
|
|
|
abbd wrote: the easy way is have every Control be handled by the GUI thread, which
could mean, use a Forms.Timer, since that executes its Tick handler on the
GUI thread. The drawback is, if the Tick handler takes too long, your GUI
responsiveness will suffer
That's quite correct.
And here is the explanation with the remedy:
http://www.codeproject.com/script/comments/forums.asp?msg=2155450&forumid=3785#xx2155450xx[^]
Did you read up on Control.InvokeRequired and Control.Invoke() by now ?
|
|
|
|
|
Hi,
InvokeRequired Gets a value indicating whether the caller must call an invoke method when making method calls to the control because the caller is on a different thread than the one the control was created on.
Form1 ^ob = (Form1^) obj;<br />
if(ob->progressBar1->InvokeRequired)<br />
{MessageBox::Show(I am in invoke ); <br />
ProgressBarCallback ^d = gcnew ProgressBarCallback(ThreadTask);<br />
ob->Invoke(d,gcnew array<System::Object^>{ob}); <br />
}<br />
else<br />
{<br />
MessageBox::Show(I am not in invoke );<br />
<br />
ob->listView2->Items->Add("GooD");<br />
<br />
<br />
}
He swow me always I am in invoke, thus he was in 1st thread, How i can add in listView??
Thank's
|
|
|
|
|
Hi,
I can't give you a C++ example. You need to construct a method that checks
InvokeRequired; in the "then" part use Invoke to call that same method (itself)
again (so it runs again, but this time on the GUI thread), and in the "else"
part do what needs to be done.
There are plenty examples around, mine would all be in C#.
|
|
|
|
|
I am trying to port this tutorial to a wxwidget application, with mingw32. This class generates the default context menu on windows files from explorer.
I have converted some parts successfully, but it seems mingw's api doesn't know anything about IID_IContextMenu3 and IContextMenu3 ( undeclared references bacause shobjidl.h doesn't exist on mingw32 api ).
Could someone help me to fix this ? ( or give me another way to display such context menu )
thx
carlos
|
|
|
|
|
To whom it may concern,
I want to develop a new GINA DLL and replace it with the Standard Microsoft GINA DLL. I want to use pki-based smart card for logon. I am familiar with GINA to some extent, but I want to know more. If there is any article available, please let me know. I'd appreciate it.
Regards,
Qeraati
|
|
|
|
|
Have you looked around on MSDN?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
|
Can you even write a GINA dll using .NET code ?
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 )
|
|
|
|
|
Is it possible, or would a wrapper be needed?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello,
I try this but there are a lot of error (I try to cal a method of the original form "form" but i can't do it)
public void TraitementForm1()<br />
{<br />
<br />
}<br />
<br />
public void OuvertureForm2()<br />
{<br />
form2 ^maForm2 = gcnew form2();<br />
maForm2->Owner = this;<br />
maForm2->Show();<br />
}<br />
<br />
<br />
private void ButtonOk_Click(object sender, System.EventArgs e)<br />
{<br />
Form1 ^maForm1 = safe_cast<Form1 ^>(this->Owner);<br />
maForm1->TraitementForm1();<br />
}
How to resolve this
thank you
very much
aef
|
|
|
|
|
Hello all,
Is it possible to generate .NET 3.0 assemblies with C++/CLI under VS2005, or do I need VS2008? I have installed the WPF/WWF extensions, but these seem to be C#-only. Maybe there is some trick to make C++ use .NET 3.0?
|
|
|
|
|
You should be able to create .NET 3.0 assemblies under VS2005 with C# and VB.NET. I've been doing so for a while now. You have to install the WPF/WCF/WWF extensions from Microsoft. Not sure about C++/CLI, I would imagine there would be a way to do it. MSDN any help?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
You can just add them as references but it might be that the designers are only supported with C# :/
|
|
|
|
|
Let me add that the designer for WPF on C# Express (even with VS 2005 Standard Edition) really bites and recommend using the Expression Blend for the design part
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
if you're going to do much WPF stuff (and especially XAML) just save yourself the headache and use C#
|
|
|
|
|
Hi,
I create thred who call a methode whitch add on listView, bu unfortunately there are an Exception on execution in line listView2->Items->Add("zezeze");
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 />
void Traitement( )<br />
{listView2->Items->Add("zezeze");}<br />
}
When i put MessageBox in place listView, he show me a message normusly, please Help me to resolve this great problem.
Thank you verry mutch
|
|
|
|
|
Hi,
An exception explains itself by giving a message, some additional information,
and a stack trace; if inner exceptions are present, these get explained too.
did you care to read any of that ?
would it not be useful to add it to your post, so others can see it ?
All we can do now is guess, and if we guess wrong all our efforts are lost.
|
|
|
|
|
Use The Force
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I do, if necessary.
I try the normal way first.
I bet it is an InvalidOperationException due to cross-thread violations
but dont want to waste message space, and everybody's time.
|
|
|
|
|
Hi,
can you shwou me, how a use force, an exeemple if it's possible,
thank you verry mutch.
|
|
|
|
|
I can not explain "The Force" to you; you will know when you have The Force,
not before that.
In the mean time, did you read my earlier reply, I was asking about the details
of the exception you are getting. That would bring us closer to a solution
for your problem.
|
|
|
|