|
Hi All,
I've tried to add the UrlEditor window to a property for a custom control I created.
Here is my code :
[
Category("Data"),
Description("URL associated with the link."),
DefaultValue(""),
EditorAttribute(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))
]
public string urldata
{
get
{
return urlData;
}
set
{
urlData = value;
}
}
Then, when I use my custom control, I have the urldata property, I can write any string I want into it, I also see the "..." button at the right, but nothing appears when I click on it.
What did I wrong ? Why does this UrlEditor not show up ?
Thanks ! Stéphane.
|
|
|
|
|
Hi all,
Im looking for a way (.net or not) to monitor file access and permit access to certain application to it...
I want to be able to get an event saying (this file) tries to do "this" to this file
Acess - Deny
Thanks
|
|
|
|
|
You can check out FileMon on www.SysInternals.com. It uses a custom .DLL to do something very similar. There's no source, but there is a discussion of how it's done. Be warned, it requires a black-belt in NTFS Internals to write it...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Anyone know a straight foward way to insert a string at the beginning of a text file that already has data in it? I thought there was an insert function in the StreamWriter, but apparently not.
For my purpose, the insert will always be at the beginning of the file and it doesn't matter if the first line is overwritten or not.
Thanks,
RABB17
Know thy limits, then add 1.
|
|
|
|
|
Figured it out. It was in the FileStream, not the StreamWriter. If anyone ever needs to do this:
System.IO.FileStream f = SupportClass.RandomAccessFileSupport.CreateRandomAccessFile(MyApp.playFileName, "rw");
int fileLength = f.Length;
line = "This is written in front of this many characters: " + fileLength.ToString();
f.Seek(0, System.IO.SeekOrigin.Begin);
//insert blank line at top of file
SupportClass.RandomAccessFileSupport.WriteBytes("/n", f);
//return to top of file
f.Seek(0, System.IO.SeekOrigin.Begin);
SupportClass.RandomAccessFileSupport.WriteBytes(line, f);
//return to end of file
f.Seek(f.Length, System.IO.SeekOrigin.Begin);
f.Close();
|
|
|
|
|
Yeah, to do a true insert of text into the file, you must rewrite the entire file. There's no other way to do it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am running into a very frustrating problem with an application which works with threads.
Basically, what I am doing is creating a number of threads which I use for executing procedures. I cannot use the thread pool as the application does not suit itself to that sort of methodology (I will need to have greater control over the individual threads). For this reason, I am creating threads and keeping them around until I need them and then using them as needed.
Anyway, what I am seeing is that, if I have my threadStart procedure use a "while not terminated" type loop, the thread takes up lots of CPU time. For example, here is the ThreadStart:
private void doSomething()
{
while (fKillThread != true)
{
doSomethingElse()
System.Threading.Thread.CurrentThread.Suspend();
}
}
In theory, this should run ONCE and then suspend itself and take no further CPU time. However that is definitely not the case. Instead, these threads peg the CPU at 100%. It is almost as if it is continuously evaluating the while condition instead of doing it once and suspending.
So, why does .NET Thread.Suspend() not actually put the thread to sleep until it is called inside of a while loop?
If I eliminate the while loop and just call suspend(), it suspends and takes no CPU time at all.
Can anyone shed some light on what is going on here?
thanks
[edit]
I found this post that looks like the same thing is happening:
http://www.highdots.com/forums/visual-studio-net-debugging/thread-suspend-causes-100-cpu-2194189.html
this was from back in 2003 - anyone know if it was ever fixed or is .NET threading just broken until I upgrade to 2.0? Is it fixed there???
khariV
-- modified at 5:02 Thursday 3rd November, 2005
|
|
|
|
|
I checked you code in 2.0. Besides the fact that Thread.Suspend() is Obsolete is working fine and you have no CPU penalty.
|
|
|
|
|
thanks for the check. While I'm not sure when we'll officially move over to 2.0, it's good to know that when we do this issue will no longer be a problem.
You say that Thread.Suspend() is obsolete - what is the new methodology for suspending threads? Do they recommend you create/free them all the time (Im going to have potentially LOTS of processes, so I figured this would be a lot of overhead).
I know I can avoide using suspend() and instead switch over to events, but is there a new and improved thinking on this for the 2.0 world?
thanks again
khariV
|
|
|
|
|
|
If you have to use 1.1 try to set your thread as background one.This may eliminate the cpu consumption inside the loop.just a thought.
|
|
|
|
|
Based on the link you gave, it looks like Thread.Suspend is buggy. How about using some other mechanism to suspend and wakeup threads, like ManualResetEvent s, for example?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello,
I've created a subclass of the Button class and I can't figure out why my OnPaintBackground method never gets called. Have any of you ever encountered this problem?
Gus
|
|
|
|
|
I figured it out:
this->SetStyle(ControlStyles::Opaque, false);
Just FYI...
Gus
|
|
|
|
|
from MS:
The PInvokeStackImbalance managed debugging assistant (MDA) is activated when the CLR detects that the stack depth after a platform invoke call does not match the expected stack depth given the calling convention specified in the DllImportAttribute attribute as well as the declaration of the parameters in the managed signature...
ok, understood, by my code is:
Friend NotInheritable Class NativeMethods
Private Sub New()
End Sub
Declare Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal _
nVirtKey As Long) As Integer
End Class
Now, how should I change the parameters to match those MDA is looking for?!?
Already tried to disable MDA via registry, but I think a solution is not covering an error ...
Thanks in advance /// Angel
|
|
|
|
|
I've found!I was sure that nVirtKey was a Long, but It's a Short (MSDN[^])
sorry ...
Angel
|
|
|
|
|
at http://republika.pl/dailybuilds/waveform.html[^] website you can use new .net multimedia library
Testing your code against performance will keep you running with good scalability and maintenance for years.
NTime.exe - the free tool for real developers of high scalability applications!
|
|
|
|
|
What is dotfuscation? and when will you go for it?
|
|
|
|
|
|
what is the significance of IDispose Interface?
|
|
|
|
|
Any object that holds on to things that need to be cleaned up will impliment IDisposable, and you should call the Dispose method on such items when you're finished with them. Common examples would include pretty much anything in the System.Drawing namespaces, or anything else that holds an unmanaged handle of some sort.
We have this interface because a garbage collected system cannot support deterministic destruction.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
To add to what Christian said I would also recomment that you use using{} when you use an object that implements the IDisposable interface and it will naturally go out of scope at the end of the method. For example:
using(SomeDisposableClass disposableInstance = new SomeDisposableClass())
{
}
When the using block is completed the Dispose() method will be called. It will also clean up the object if an exception is causing the stack to unwind.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
That's if he's using C#, I don't believe VB.NET supports it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
It is supported in VB.NET 2.0, so you will be ok if thats what you are working with.
MCSD(VB6/SQL7)
MCAD(C#/SQL2000)
MCSD(C#/SQL2000)
|
|
|
|
|
Can someone tell me if the VS.NET 2005 designer is smarter than the 2003 version?
Can I view inherited forms and controls in the designer?
My root problem is where the base control or form is declared as MustInherit.
I will be installing my version in the next few weeks but would love to know ahead of time.
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|