|
What u want now?
Any thing wrong in it? Give me ur problem detail.
Syed Shahid Hussain
|
|
|
|
|
I dig out why it was not working ...
a form can be resize to have biger size then earlier ... and cant be risize to smaller one
vikas da
|
|
|
|
|
your code is perfect and am using the same ... but can use to increase the size of the form only .. it cant be used to reduce the size of form ..
Thank you very much for your reply ...
vikas da
|
|
|
|
|
My pleasure, Welcome for more assistance,
Be Happy
Syed Shahid Hussain
|
|
|
|
|
Hi,
I am trying to create a CPU Usage monitoring application. I am using PerformanceMonitor to do it. However as I was observing the data from Task Manager's CPU Usage column (Process Tab) and Performance Monitor (Process - % Processor Time) readings, they don't seem to coincide at all (Not even close). I tried to change the Performance Monitors sampling interval, but I can't seem to make the 2 coincide.
Does anyone, know why the readings are different?
Thanks.
SDE
|
|
|
|
|
|
Thanks.
SDE
|
|
|
|
|
Hallo to all.
I do not know if this is possible, but it is worth a try.
I am currently integrating with a module from Accpac. By using the dll's. The data you insert through the dll is very specific. If i run the macro generated from Accpac, it will return a message to me. eg. The invoice nr have been used. But when the error is in c# i just get a Com Exception.
I want to be able to get the message from the dll, to show as exception in C#..
Help ?>
Thanks in advance.
Vendetta
|
|
|
|
|
If it's not in the inner exception, or the COM error code, then it's not being passed to you.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
So there is no way I can fetch it then...damn
Vendetta
|
|
|
|
|
I´m trying to create .txt files with iso-8859-2 encoding, but I have problems with some of the characters from the charset. They don´t display correctly in the file.
Here is my code sample that I use to create the files:
File.WriteAllText(filePath, fileContent, Encoding.GetEncoding("iso-8859-2"));
Can anyone help me with this?
cellardoor
|
|
|
|
|
That looks perfectly fine.
What are you using to display the file? Does the encoding actually support the characters that you write to it?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
cellardoor0716 wrote: I use Notepad.
That would probably explain it. Notepad only uses that encoding if it's the default encoding for your system.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yes, that was the problem, thanks for your help.
cellardoor
|
|
|
|
|
I have an object that creates an expensive COM object as soon as my object's Constructor is called. This COM object is treated as a private field in my object.
My object is then responsible releasing that COM object. Not releasing it is expensive and problematic.
So I put the release code for the COM object in my object's destructor, assuming my object's destructor would be called as soon as my object was set to NULL or went out of scope. However, this is not the case. My object's destructor is not called until the garbage collector runs.
This is a problem. I need my object to release the COM object as soon as it's not needed anymore. If I don't, there are problems with the COM server application - ie, it won't close, etc.
How can I insure that my object releases the COM object as soon as my object is set to null, or goes out of scope? Where do I put the COM release code?
|
|
|
|
|
You can't. You can use the dispose/finalise mechanism to let your users call Dispose to close it, or for finalise to do it when the object is GC, if dispose was not called. Welcome to garbage collection.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Well, that's painful. Thanks for the quick answer, though.
|
|
|
|
|
This suggests, then, that I shouldn't even bother putting the COM release code in my destructor, right? The COM object will be released anyway when my object gets GC'ed, correct?
|
|
|
|
|
Any object that uses any unmanaged resources should implement the IDisposable interface, so that the resources can be released in a controlled manner.
You have no control over when the object is garbage collected, and there is actually no guarantee that the object is ever garbage collected.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
"Yes, but then I wouldn't be watching TV. You can see my dilemma, right?"
Sigh.
|
|
|
|
|
I have this problem with Enterprise Architect (modelling software from Sparx). The program exposes a COM automation interface for add ins, and when you write an add in with C# it can happen that the application refuses to close because your add in's COM reference which has not been garbage collected.
Sparx recommends to call GC.Collect() and GC.WaitForPendingFinalizers(). Maybe you can do this in your Dispose() method after releasing the COM reference. It's often said one should not call the GC methods for performance reasons, but when it's about releasing a big COM object they're probably justified.
|
|
|
|
|
Wrong. Non-managed resources, need to be dealt with in your code. The idea is you impliment IDisposable, so the user can call Dispose to force cleanup, but write code that does the cleanup if Dispose has not been called.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
As Guffa pointed out, the GC has no knowledge of how to release unmanaged memory, which includes COM objects. It expects that your managed class will provide the necessary logic to free those resources during GC by implementing IDisposable .
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
After nulling all references to the COM object, you can call GC.Collect () to force garbage collection. See ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref2/html/O_T_System_GC_Collect.htm
|
|
|
|