|
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
|
|
|
|
|
I expect error messages to be output through stderr, so IMO you really need to capture both!
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
|
|
|
|
|
Hi Luc,
Yes, at first it would seem to make sense that error messages are output to stderr, but apparently some are not. You see, when I do a simple command line redirection of only stdout into a file, the error messages do get redirected into that file. But, if I redirect stderr only, the error messages are still displayed on the screen.
I believe the reason they do it this way is because stderr is normally used for error messages concerning problems in the application itself (the C/C++ compiler in this case). However, when the compiler encounters syntax errors in the code it is compiling, that is not an application error, so the messages concerning these errors are merely produced like a report and, thus, stdout is more appropriate. At least that's how I belive they decided upon this.
Anyway, I've got a klugey work-around to my problem of the missing last line of stdout when capture is attempted in C#. I wrote a 2nd custom application in C that looks at its argc/argv, concatenates argv[1] through argv[argc-1] together, then makes a call to the "system" library function with this concatenated string as the argument. Then in my C# program I start this custom process after initializing its arguments to be cl.exe with all the cl.exe arguments I want plus a redirection string. So, my custom process ends up being the one that actually runs the compiler and does the redirection. It's admittedly klugey but at least it works properly, whereas the version that directly starts the compiler process from C# does not. I'm sure I'm simply doing something wrong in the C# version, but as of yet I don't know what it is - and I just need to move on with my task!
Ray
|
|
|
|
|
Hi Ray,
long time ago (before .NET 2.0) I did a Process.Start() thingy with both stdout and stderr
redirected, and I ended up using two threads performing ReadLine() to read stdout/stderr
while the process was still running, mimicking a real Console operation, as opposed
to the new ReadToEnd which IMO blocks until the process is done and hence does not
correctly interleave stdout with stderr.
The only problem I had then was to get it also right on Win98, which has a completely
different kernel, and seems to be handling things quite differently.
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
|
|
|
|
|
hi ..
for my project ... my teacher asked me to bring him a program to check english Grammar.
he said i can find the codes on the internet and use it ... as a componet or any way i like
i searched google and every place i could ... but i only can find online grammar checker or a program
not any source code ... so can any one help me about this ??
my english is not good so i dont think i can write Grammar checker bymyself ... i searched here but all i found is Spell checker ... i need Grammar checker.....
is there any componet or source code ??? my email is maboudian@gmail.com ..
ill check here also ... im counting on you guys please help me
|
|
|
|
|
I did a quick search myself and found a commercial grammar checking component that you can use in C#: WinTree Software[^]
|
|
|
|
|
Judah Himango wrote: I did a quick search myself and found a commercial grammar checking component that you can use in C#: WinTree Software[^]
hi thank you ...
but i found this site to ...
it has componets but i have to buy it .... i cant buy because i live in iran and i dont have credit cards...
( usa dont allow us to have it )
so if u got a free dll ..( componets) or soruce code please tell me
but thank you anyway
|
|
|
|
|
Have you considered looking around on sourceforge or any open source?
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
Hi!
I've written a screensaver for windows using c# and it's been a smooth jounrey so far.
But when I try to run it on Vista there is a major problem.
The user can alter a bunch of settings on how the screensaver should behave using the standard "settings" button in the screensaver section of the control panel. These settings are stored in a user.config file under the user's account, I am using the the "Settings" framework in VS.NET 2005 for this which makes the whole procedure really easy to code.
The problem is that vista Launches the settings window (when the user clicks the "settings" button in the control panel) as a regular application, storing the settings in the current user's "user.config" file. However once the screensaver is actually triggered, Vista runs it in elevated mode as an administrative user, so the settings that the user specified are not actually used.
If anyone has an idea on how to work around this problem I would be very grateful. I would very much like to be able to use the auto-generated stuff in VS.NET as it makes things really simple.
Peace
/Mattias
Mattias Norlander
|
|
|
|
|
Does anyone know how to make a custom form, and by that, I mean make it the same, but look different and you have control over how it looks? I know you would first set it to have no border... but then what? Thanks in advance... -M.S.
|
|
|
|
|
MasterSharp wrote: Does anyone know how to make a custom form
No different than any other form. Not sure exactly what you are asking.
MasterSharp wrote: I know you would first set it to have no border... but then what?
Add the controls you want...
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
I mean, how would you make a windows form, except, well, not WINDOWS. It would be custom, where you could put the blue bars where you want, change the form's color, or is there already a way to do that? I want to make a form that looks like on vistas.
|
|
|
|
|
If you're not on vista, you need to make the controls owner drawn, which means you write all the code to control every aspect of how they appear.
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 )
|
|
|
|
|
Yes. That's what I'm asking about. Does anyone know some code already that does it and is willing to share?
|
|
|
|
|
So, you want to make a custom form that looks like a vista form? Correct?
|
|
|
|
|
|