|
the forum title says it all
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Im attempting to transfer data between two programs using a Named Pipe server.
I am controling the server via the client; I can control when to start the server and when to wait for incomming connections.
My problem is the server pauses execution untill it gets a connection from the client, but since the program is paused I cant tell the client to attempt to connect to the server.
Is there a way to solve this catch-22 without using threads?
All suggestions welcomed!
|
|
|
|
|
No, I'd say threads are it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Reveille0 wrote: I cant tell the client to attempt to connect to the server
That sounds like your catch-22 there....
How can the server tell the client anything if the client is not connected?
There needs to be some connection for the client to control the server, yes?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have some openGL projects that use auxWireCylinder(...) which was provided in glaux.lib. This library has apparently been deprecated, and is no longer available in VS 2008. Does anyone know where/how I can get this functionality back (or what I might use in its place?).
Thanks,
Tom
|
|
|
|
|
Dear Sir,
Can I have the version of DataGridViewPrinter Class In Visual c++ NET 2005 ?
Or is there a mean to use C# class in Visual c++ NET ?
This class allows to print a DataGridView.
|
|
|
|
|
I create a form Form1.h. Put a button in this form to open another form Simulation.h. In order to do this, i #include "Simulation.h", create a handler Simulation^ S1 = gcnew Simulation(); then S1->ShowDialog()
After that in Form1.h, this can be done.
btn1_click(...){ //button click event
this->btn1->Text = "ON";
S1->btn1->Text = "ON";
}
I want btn1 text in Form1 class change then btn1 text in Simulation class change also and vice versa
In Simulaion.h, i create a click event also:
btn1_click(...) {
this->btn1->Text = "OFF";
????
}
i want to use Form1's btn1 but here i cannot include Form1.h to Simulation.h so cannot create a handler of Form1 class. As it is OOP i try use this code Form1::btn1->Text but cannot also. in this case how can i use btn1 of class Form1 in class Simulation? Thank
|
|
|
|
|
|
Thank for your suggestion. I have read through article and try out the codes but i still cannot make it. In order to create a handler of other form ref class in c++/cli, i need to include the form header. By including Simulation.h in Form1.h i can easy create a handler and utilize ref class Simulation variables. But after that i want utilize Form1.h variables in Simulation.h cannot make it because i cannot inlcude Form1.h in Simulation.h. So i wanna find a way that i can use Simulation.h variable in Form1.h and can use Form1.h variable in Simulation.h at the same time.
The article is in c#, vb.net no need hearder can create the class object and just one way passing. I try the same code in c++/cli it not work.
Really hope that there is a way to do it. If not, i may just pass the value to databse to use by other which cost me some time.
|
|
|
|
|
Hi
I want to change the color of the keyword. for that i read the file and store it as a string. From that i will read the word by word file content and i will check the keyword is matched with the file content or not if it is present it change the color.
for that i wrote the code as follows
array<string^>^ dataTypesTable = gcnew array<string^>{"int","void","float","double","long"};
String^ filecontentpath = this->m_pFileOpenDialog->FileName;
String^ content = File::ReadAllText(filecontentpath);
MessageBox::Show(content);
int length = content->Length;
cli::array<string ^=""> ^str = content->Split(nullptr);
if(str->Length>0)
{
for(int j=0;j<str->Length;j++)
{
for(int i=0;i<datatypestable->Length;i++)
{
if(String::Compare(dataTypesTable[i],str[j])==0)
{
this->srcTextBox->SelectionColor = Color::Blue;
}
}
this->srcTextBox->AppendText(str[j]);
this->srcTextBox->SelectionColor = Color::Black;
}
}
now my problem is it disply the file in a single line .
can you tell me how to read the content of a file in word by word
Thanks
|
|
|
|
|
What happened to just finding the keywords in the richtextbox?
This is a relatively simple problem and you keep making it more complex but haven't
found a solution yet.
I'm confused.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
When i was using the find methed for processing the huge file it took so much time.
so i used this method . Now i want to know how to read word by word.
Thanks
|
|
|
|
|
rose196 wrote: Now i want to know how to read word by word.
You'll have to read blocks of the file (or lines) and parse the words.
I don't know how you're going to change the colors of the text faster.
What format is the data in the file?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
When I compile with /clr, does the resultant executable contain both IL and native machine code?
Or does it somehow compile even the native C++ into IL?
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
Independent123 wrote: does the resultant executable contain both IL and native machine code?
They hide that information in the documentation[^]
led mike
|
|
|
|
|
You need to use #pragma unmanaged around code you want compiled to native.
Otherwise, all the code is compiled to IL.
More documentation: Mixed (Native and Managed) Assemblies[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi ...
I have asked this question but nobody answered ...
I want to call a function in the parent class of a dialog...
How to do that?
p.s
When I include parent header file in the child and child header file in header I get this error:
/////// Form1
#include "Form2.h"
Form2 ^f=gcnew Form2;
f->ShowDialog();
/////////Form2
#include "Form1.h"
Error:
syntax error : identifier 'Form2'
error C2065: 'f' : undeclared identifier
error C2065: 'Form2' : undeclared identifier
error C2227: left of '->ShowDialog' must point to class/struct/union/generic type
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
Is the Form2 class in a different namespace than the code throwing the errors?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hello,
in our company we have a solution with a lot of (dynamic)ibraries which we wont use in all of our projects.
Now to use the unmanaged libraries is not a big problem. here we can use autolink to link agains the right library (debug mode and so on..).
How I can solve the problem to make a reference to the right mixed library (the designer should also work!)?
Best regards
Hansjörg
|
|
|
|
|
Hi,
I just want to check the file whether it has certain word or not.
i read the file but i don't no how to check the word is present or not.
i wrote like this
array<String^>^ keyword = gcnew array<String^> {"int", "void", "float","double","longint"};
int len = keyword->Length;
FileInfo^ fi = gcnew FileInfo( this->myTabPage->ToolTipText);
FileStream^ fs = fi->OpenRead();
int nBytes = fs->Length;
array<Byte>^ filecontent = gcnew array<Byte>(nBytes);
int nBytesRead = fs->Read( filecontent, 0, nBytes);
Can you help me
Thanks
|
|
|
|
|
If the file you are using is a text file, then using a StreamReader may be much easier
than reading the file as an array of bytes.
If the file is binary and you're looking for embedded text, then you may have to search for the
character sequences yourself.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
I am going to read the cfile.
For that what i have to do.
Can you give any model code.
Thanks
|
|
|
|
|
rose196 wrote: I am going to read the cfile.
Huh?
You're going to use the MFC CFile class instead of the .NET file classes?
If so, the solution is exacly the same.
The CFile class "provides unbuffered, binary disk input/output services".
So my answer would be the same - CStdioFile is probably a better choice if you're working with text
files. If the files are binary with embedded text, you'll probably need to search for the text yourself.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am connecting a device through GPRS, using SLIP. But that doesn't work. (if you can help here, ok) so I need to change the protocol from SLIP to PPP.
So does anybody know the bare minimum PPP protocol implementatation, bare minimum just to send and receive. In C?
Thank you very much.
|
|
|
|