|
If your app is running with all forms closed, you must have a thread running. What if you debug, close all and hit the break menu item to see where the code is ?
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 )
|
|
|
|
|
Use Application.End() function it will close the application
with regards
yogesh agarwal
|
|
|
|
|
You mean Application.Exit() ?
|
|
|
|
|
hi all and thanks for trying to help ,
currently im working on a project wich involves a multi threaded server
and a client program .
can anyone advice me of a common method which i could retreive with my client program an updated list of users online on my server , which keep updating once user left the server or a new user has joined the server ,
i mean many online games or applications have something like that , i would like to know how to do it , any advice would be great thanks.
Net
|
|
|
|
|
When any user update in a server list then server send an event to client with updated list and then update the client list.
Clien hold the Remote server object and when server object raise an event then client trace that event.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
thanks for your answer ,
if i have 100's of users on my server...would it be a " wise way " to costantly send an updated list to all of my 100's of users for any small event such as this ?
or is there any more efficient way to this?
-- modified at 1:51 Monday 1st October, 2007
Net
|
|
|
|
|
So you are not able to creat a client listner event for server ?
It's easy way you can creat a client listner and handle in it with parameter.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Parwej Ahamad wrote: So you are not able to creat a client listner event for server ?
Parwej,
As per my knowledge, we wont be able to fire events on client/server using TCP communication. Because messages will be passed through streams. So how events are fired ? Or am I missing something ?
|
|
|
|
|
udikantz wrote: can anyone advice me of a common method which i could retreive with my client program an updated list of users online on my server ,
How you are communicating with the client to server ? Are you keeping client socket object on server ? if yes you can create a method on server which returns the total count of this objects. Client has to send message to the server requesting for this number (may be you could define some proprietary protocols). Catch the message on server and call the appropriate method, and sends the message back to client.
|
|
|
|
|
i am communicating with client server over a tcp socket as for now i am using strings to communicate.... , i am keeping client socket object for each client on the server side , i need to send some sort of updated list or dataset to all of my clients which includes information such the username and some other stuff.... , the question is how can i send that kind of list , there must be some efficient technique for that cause almost evry server have this functionality , hope i was more clear.
thanks again!
Net
|
|
|
|
|
udikantz wrote: he question is how can i send that kind of list , there must be some efficient technique for that cause almost evry server have this functionality
I am not sure that you can send a dataset. But you can create a custom serializable class which holds all the information to be send, then send that object through stream.
|
|
|
|
|
Hy,
A nice way to send a list to the client would be to create an XML string with everything you need, something like:
<users>
<user id="...">
<name>...</name>
<surname>...</surname>
</user>
<user id="...">
<name>...</name>
<surname>...</surname>
</user>
</users>
An XML string is very easy to send over TCP/IP, it's small in size...and you can work on that string on the client side using XMLDocument or such.
Hope it helps,
Do your best to be the best
|
|
|
|
|
thats a realy nice idea ,
is there any classes / methods i can use in order to construct the xml strings i wish to send?
Net
|
|
|
|
|
actually I used my own methods to generate the XML string, mainly by manipulating a StringBuilder class
Do your best to be the best
|
|
|
|
|
So on my desk, i have nothing but a computer running Windows XP SP2.
I want to connect a usb connector into my computer, into a component board with an LED.
Then I want to create a program in C# command line that I can turn the light on and off.
I'm told this could more difficult than I'm planning on... But if anyone has ANY ideas on where to start, or tutorials etc, I would be greatly appreciative.
Thanks
|
|
|
|
|
basically this kind of programs in Windows 2000/NT based systems work with a special driver u would need to download the driver first and then may be search for an API that would help you communicate with the USB device.the driver is needed because unlike the Windows9X based systems, XP,2000/NT do not allow direct access to the kernel.
|
|
|
|
|
If you buy a USB-to-RS232C cable, you can connect a LED (with resistor!) to one of the
serial control lines (e.g. RTS); the serial port will show up in the list of available
serial ports, and the SerialPort class will provide access to the control lines.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello all..
I have been using ASP.Net 2 with c#.My problem is as follows:
I need to put an image.I have used an image control for the purpose .i have well placed the image.But when i view the page on the browser the image doesnt seem to fit into the control but the image takes its original size.How can i auto fit it into the control?Any ideas?
confusedme
|
|
|
|
|
You put the size in the control and it will size it.
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 )
|
|
|
|
|
Hi
Thanks for your prompt reply.But how can i put the size?
well,in the properties window the size of the image control is 95px by 130px.The source also holds the same value.What am I missing?
|
|
|
|
|
What properties window ? You're doing ASP.NET, right ? You should just be editing the aspx directly. It has width and height properties, or you can add them. Check they are making it to the end HTML, and if not, you need to work out why.
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 )
|
|
|
|
|
hello
I want to validate date on the template of datagrid. My code is
if(e.Item.ItemType == ListItemType.Item)
{
TextBox txtGraRecItem=(TextBox)(e.Item.Cells[6].Controls[1]);
txtGraRecItem.Attributes.Add("OnDblClick", "AssignDate('"+(dgDetailData.Items.Count+1).ToString()+"','"+e.Item.Cells[6].Controls[1].ID+"');");
}
if(e.Item.ItemType == ListItemType.AlternatingItem)
{
TextBox txtGraRecAItem=(TextBox)(e.Item.Cells[6].Controls[1]);
txtGraRecAItem.Attributes.Add("OnDblClick", "AssignDate('"+(dgDetailData.Items.Count+1).ToString()+"','"+e.Item.Cells[6].Controls[1].ID+"');");
}
if(e.Item.ItemType == ListItemType.Item)
{
TextBox txtGraDueItem=(TextBox)(e.Item.Cells[7].Controls[1]);
txtGraDueItem.Attributes.Add("OnDblClick", "AssignDate('"+(dgDetailData.Items.Count+1).ToString()+"','"+e.Item.Cells[7].Controls[1].ID+"');");
}
if(e.Item.ItemType == ListItemType.AlternatingItem)
{
TextBox txtGraDueAItem=(TextBox)(e.Item.Cells[7].Controls[1]);
txtGraDueAItem.Attributes.Add("OnDblClick", "AssignDate('"+(dgDetailData.Items.Count+1).ToString()+"','"+e.Item.Cells[7].Controls[1].ID+"');");
}
how to validate cell[6] and cell[7]. cell 6 should be greater than cell 7.
AssignDate is just calling a function to show calander.
-- modified at 2:44 Monday 1st October, 2007
|
|
|
|
|
Hello,
I want to start a process from within a C# application, then capture that process's stdout output and display it in a C# multiline TextBox. The process I want to start happens to be the Microsoft Visual Studio 2005 command line C/C++ compiler, cl.exe. Just to get you up to speed on the problem though, below is what I get if I simply open a command window and run the command line compiler cl.exe from there on file main.c.
If I do:
cl main.c
I get the following output to my command window if it succeeds:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
If I redirect stdout into a file, the file contains:
main.c
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
Note that the first part about the compiler version is missing because, for some reason, Microsoft chose to output it to stderr instead of stdout, but that's not the issue I care about anyway.
Now, if I intentionally introduce a syntax error into main.c on line 6, I get the following instead of the above.
No redirection:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
main.c(6) : error C2059: syntax error : ')'
With redirection, file contains:
main.c
main.c(6) : error C2059: syntax error : ')'
This is all well and good. My goal for trying to capture stdout with a C# program is simply to capture what ended up in the file in both of redirection cases above. The C# code below represents a code sample I got directly from an MSDN example of how to start a process and capture it's stdout:
Process proc = new Process();
proc.StartInfo.FileName = "cl.exe";
proc.StartInfo.Arguments = "main.c";
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
string output = proc.StandardOutput.ReadToEnd();
if (output != null)
{
myRichTextBox.AppendText(output);
myRichTextBox.AppendText("\n");
}
proc.WaitForExit();
If I run this code on the version of main.c that doesn't contain the syntax error, I get the following displayed in my text box, exactly as I would expect and exactly like when I did all this from the command line itself:
main.c
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
However, when I do it with the version of main that contains the syntax error on line 6, I get the following in the text box:
main.c
Notice that the line actually describing the error is missing:
main.c(6) : error C2059: syntax error : ')'
So, that is my problem. Why is that line missing? Obviously this line is being output to stdout rather than stderr or it wouldn't have gotten redirected in the command line version. I'm thinking it's probably a C# or .NET bug, but I'm probably wrong. I tried moving the proc.WaitForExit before to the ReadToEnd function (even though MSDN said not to do this), but that didn't help. I also tried putting a 5-second Sleep after the Start but again, no improvement. Possibly simply redirecting stdout directly into a file from within C#, then opening that file and reading it is a work-around, but I don't know how to do that. So, what do you think?
Thanks,
Ray
|
|
|
|
|
Hi,
if you want to simulate a console, you must redirect both stdout and stderr.
in order to get real-time behavior, that will take two threads, one for stdout, one for
stderr. Both of them need to obtain their input, and send it to your textbox using
Control.InvokeRequired and Control.Invoke in order to avoid cross-thread violations.
warning: details of the behavior depend on the exact Windows version; Win98/WinME are most
difficult to get right!
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks Luc,
However, at this time I don't need to capture stderr. My main concern is with why my capture of stdout does not capture the last line when done from C# but does work correctly when done from simple command line redirection or from a "system" function call within a C/C++ program.
Ray
|
|
|
|