|
Hi,
AFAIK you can't tell anything about a serial port unless you (try and) open it.
Which means, if some application has opened the port in order to use it, you can't open it
in a monitoring app since the port is "in use" or "allocated", and you can't get any
information whatsoever.
Of course, if the one app closes the serial port as soon as it is done receiving/transmitting,
then the monitoring app could try an open, and report success/failure. Mind you, if it tries
periodically, it may cause the main app to fail when that wants to use the port!
Also I am afraid the above is how serial ports work on Windows, no matter what language
and framework you intend to use.
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.
|
|
|
|
|
There is an activex.exe which is written in vc++ and now i have to call some method of it through C# class library to use in asp.net 2.0
This method accepts some variant type parameters in actual and after taking reference in c#, it's show's to pass parameters as an objects with ref and also returning an object. but everytime i call this function it gives an error -i am using reflection, InvokeMember - : the exception are : Exception has been thrown by the target of an invocation and The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) , i am not able to figure it out what's wrong with it while i am able to call the all those functions which does not required any parameters successfully .
Stack Trace:
COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +2453568
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
WebApplication1.CreateObj.mXML_Response(String xmlString) in F:\Parvesh\Projects\componenttest\WebApplication1\WebApplication1\CreateObj.aspx.cs:116
WebApplication1.CreateObj.Button1_Click(Object sender, EventArgs e) in F:\Parvesh\Projects\componenttest\WebApplication1\WebApplication1\CreateObj.aspx.cs:68
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
I also made a object array through which i am passing my values like
object myobj = new object[5]
myobj[0] = "mystring";
myobj[1] = "";
........
and passing like in : new object[] {myobj[0], myobj[1]....}
Any Help?
|
|
|
|
|
Hello everybody
My project is a C# project on VS2005.
My application communicate with external device through Serial Port.I'm using USB to RS converter whitch add another COM Port in my computer.When I connect with device through this COM Port(transmit and receive data) everythink is OK.When unplug the USB cable from PC COM Port is still open and I try to transmit data the program is generate exception(Access to the Port is denied).How can I detect when the COM Port is disappear?
Thanks in advance
|
|
|
|
|
Reposting is considered rude - please don't do it, it was only 17 hours ago you asked the same question which I have just responded to.
(Maybe you should add no-reposting to the guidelines Chris?)
Here[^]
Dave
|
|
|
|
|
It's a bit of an odd scenario since real serial ports don't tend to disappear, and it doesn't seem this possibility was taken into account when Microsoft wrote the SerialPort class: There's no event that indicates Com-port "disappearance" in it.
I guess your best option would be to start a separate thread that polls SerialPort.IsOpen every now and then: Most likely this will throw the error you got earlier when you disconnect the USB adapter, so you can catch that to see if the port's still there... Of course, you'll need to catch it at any other reference to SerialPort as well, that's just decent programming.
Alternatively, there might be a class somewhere in the .Net framework that monitors USB devices, don't have any experience with that. Could very well be a p/invoke kind of thing.
Standards are great! Everybody should have one!
|
|
|
|
|
I Need Some Code For Detecting Seriao Port As COM post Of My System. But Every where written in .Net2.0 Serialport.Port name space is used but iam develope my project in .Net1.1 then plaese Help ME
Thanks
In Advance
|
|
|
|
|
Hello All,
Actually i am new with C# and need to overload assignment operator(=) in C#,
when i am trying to overload assignment operator as follows
public static operator = (double a)
{
}
but it gives error as "overloadable unary operator expected"
plz sufggest me what i have to do?
thanks
Bankey
|
|
|
|
|
|
Hi bankey,
"=" can't be overloaded in C#.
For your information other oerators like, . , ?:, ->, new, is, as, sizeof too can't be overloaded.
Regards,
Panicker.
P.S. Mark as answer if you feel the reply is appropriate.
|
|
|
|
|
Hi,
you can implement implicit conversions though, so that may or may not solve your problem.
look for the implicit keyword.
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.
|
|
|
|
|
Hello Friends,
I have a problem with print and printpreview.
I an using this code to print but there is a problem
Bitmap memoryImage = new Bitmap(panel1.Width, panel1.Height);
panel1.DrawToBitmap(memoryImage, panel1.ClientRectangle);
printDocument1.Print();
that it print one barcode on one page and another barcode on another page. As i want that it will utilize whole page means i know that on page page there should be 5 barcodes so how can i achive this....
And how can i show Print Preview
Thanks
|
|
|
|
|
|
Wrap the particular application up in a CCW. (Com Callable Wrapper).
|
|
|
|
|
Could you please tell me a bit in detail? Which application you want me to wrap?
A guidance to some kind of example will be very nice. Thanks for a reply.
Regards,
Pavas
|
|
|
|
|
Hi,
Is there any control in C# , In which we can load rtf wtih header and footer and do margin setting as well.
If you have any idea about this, then please inform me at
khaleek_ahmad@yahoo.com
Thanks in advance
Khaleek ahmad
|
|
|
|
|
You can use richtextbox to load rtf files but I'm not sure whether you will be able to manipulate with margin settings. You could give it a try though. I guess you can achieve what you want using this article: Integrating Microsoft Word in your .NET applications[^]
|
|
|
|
|
I am trying to write code for compiler using Codedom. I am unable to compile code which uses COM references. The code gives file not found exeception while adding COM reference to Compiler parameter object even if it is present in the output folder of the code to compile(No idea why).
The possible solution I can search of is to get the executable path for the code to compile because those dlls are present in the same folder(I may be wrong here).
How can I get the executable path of the code that will be compiled??
or
Am I going with wrong approach?? If yes, then how to solve this issue????
|
|
|
|
|
Did you generate the assembly you are adding with 'tlbimp'. You can't add a direct reference to a COM library.
|
|
|
|
|
I am working on a addin in that one part is to move mails from one folder to other folder
like this i am getting both folder info..
string S_fold = rm.GetString("Source folder");
MAPIFolder oFolder1 = null;
oFolder1 = oExp.Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Folders[S_fold];
The above source folder is sub folder of inbox similarly i have destination folder also...
so can anybody tell me now ... how to move mail from one folder to another is thereany existing function is there..
i was trying like copy the mail to destination and then deleting the mail from source but
i am not able to copy mails from one folder to other though i can copy the folder
please help me here...
Thanks in advance...
vikas da
|
|
|
|
|
How can I have a delegate or button continue an ongoing process that was stoped. And how do pause a process at a set interval(see below).
for (int i=1; i<=10000; i++)
{
for (int j=1; j<=10; j++)
{
a = a + 1;
}
//Pause process here everytime
//Continue process with button is pressed
}
Thanks in advance
Michael
|
|
|
|
|
Are you not able to implement with timers or Thrading ?
/***********************/
Parwej Ahamad
g.parwez@gmail.com
/***********************/
|
|
|
|
|
MessageBox.Show is going to stop the process and it will restart when you close the box.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
try
Thread.Sleep(<MILISECS>);
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I already considered sleep, but this won't work I have a timer that needs to start the process at set intervals using a delegate.
Michael
|
|
|
|
|
so then you should use MessageBox as Christian Graus said
or use timer_tick event intead of for loop
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|