|
DoEvents isn't called at all during the processing. The WaitCursor just won't stick - I have tried setting the cursor on every single control to the WaitCursor - which kind of works although it doesn't stop mouseinput - the user can still click on things, drag stuff around, press buttons etc. So the WaitCursor doesn't seem to do much - is that what is supposed to happen? Is there a way to disable mouseinput without disabling every single control?
|
|
|
|
|
What are you using to profile the execution of your application? On other thing you might try is to override OnCursorChanged and set a breakpoint to see if anything else is setting it. Note that this event handler is not called if a native call changes it.
You could set Form.KeyPreview on the container form and disable keys effectively, but to disable mouse events for all child controls you'll need override WndProc on the form and handle the WM_PARENTNOTIFY (0x0210) message, where the low order (second half) of the Message.LParam is set to WM_LBUTTONDOWN (0x0201) or WM_RBUTTONDOWN (0x0204), and conditionally handle the message (allow it to be processed by calling base.WndProc(ref Message) ). Your code must be fully trusted to override WndProc .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
use <threadobject>.Join()
this way this thread (whose instance is mentioned above) would wait for all child threads to "die" first before proceeding.
|
|
|
|
|
Thanks for the tip. If after i create the thread t and then do t.Join() the application don't stay "Not Responding" but it stays stopped until the thread t stopps. I think that the application stay's in "Not Responding" because in ApplicationTick1() i refer a recursive method. This method takes a while to do it's job and in that while the application stays "Not Responding". Here is a sample of the code in ApplicationTick1:
// preenche a arvore
MyDelegate d = new MyDelegate(LDAPLibrary.Class1.FillTreeView);
this.Invoke(d,new object[] {conn,tv.Nodes,p2,true});
|
|
|
|
|
That won't start a new thread. Control.Invoke actually executes the method on the thread on which the control was created. That's useful when you're doing something in a different thread and need to update the UI. As I said in my reply, you must always update the UI on the thread on which the control was created. That's why the Control class implements ISynchronizeInvoke .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I want to implement a telephone answering machine. Have searched for the resources but all of them are for MFC. Can anyone who have done it in C# help me in this regard ?
|
|
|
|
|
TAPI and C# don't play well together, you have to do a lot of P/Invoke and Interop work. My prefered solution is to build a COM wrapper in C++ for the telephony functionality and then use it via COM interop in C#.
However Helen Warn has produced this C# wrapper[^] that will get you started.
Michael
CP Blog [^]
|
|
|
|
|
You beat me to it
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
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.
|
|
|
|
|
Try here:
http://www.gotdotnet.com/community/usersamples/Default.aspx?query=Tapi[^]
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
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.
|
|
|
|
|
thanks for the help
|
|
|
|
|
I have a typical many-to-many relationship between three tables; Apps, AppsToReports, Reports. I am finding it hard to figure how to add DataRelation objects to a DataSet to cover the relationship between Apps and Reports. I saw the DataRelation constructor .add(rel. name, parent table name, child table name, parent columns[], child columns[], bool nested) but can not find any examples of its use or if it would solve my need. As you might assume, I am trying NOT to write large amounts of code. All DataRelation objects I create must have the parent as a unique value which is not true in a many-to-many relationship from the center table to its details. If I must code around this issue then I must but am hoping for a more simplistic solution. Any help would be appreciated.
Bill
|
|
|
|
|
Have you checked out the documentation at MSDN[^]? It shows a quick example on how to do this. For reference, check out this article on CP that talks about Data binding for many-to-many.[^]
~Javier Lozano
(blog)
|
|
|
|
|
Let me first preface this question with a disclaimer. I've never used regular expressions before so I am admittedly clueless!
I'm trying to validate the entry of a TextBox using regular expressions. The entered value should only pass the validation if it contains contiguous alpha characters. The code below breaks if something like "ABC 1" is entered. Any occurance of a space in the string seems be ignored...
Regex re = new Regex(@"[a-z|A-Z]");
return re.IsMatch(TextBox1.Text.ToString(), 0);
What can I add to the pattern to test for the occurence of a " " within the string that will cause the validation to fail?
p.s. Is there a Regular Expressions for Dummies book?
Paul Lyons, CCPL Certified Code Project Lurker
|
|
|
|
|
|
"[a-z|A-Z]" will match on any string that contains any alphabetic characters, including something like "123456a789". If you want to have the whole string pass or fail, bracket the regex with ^ (beginning of string) and $ (end of string).
Also, unless you want to match one - and only one - character, you should specify the length of the intended match. * match zero or more occurances, + matches one or more, and {#, #} matches a given number of matches (for instance {1, 4} will match if there are at least one, but no more than four occurances).
So, if I'm correct in my understanding that you want to match "A", "ABC" and "abcDED", but not "", "ab c" or "abc123", you'd use something like "^[a-zA-Z]+$". (Note that the pipe isn't nessecary in this case).
As an aside, you don't need to call ToString on the Text property, as it is already a string.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Charlie Williams wrote:
So, if I'm correct in my understanding that you want to match "A", "ABC" and "abcDED", but not "", "ab c" or "abc123", you'd use something like "^[a-zA-Z]+$". (Note that the pipe isn't nessecary in this case).
You are absolutely correct and I appreciate your help!
Charlie Williams wrote:
As an aside, you don't need to call ToString on the Text property, as it is already a string.
I'm just anal that way sometimes. I can't control myself...
Thanks again!
Paul Lyons, CCPL Certified Code Project Lurker
|
|
|
|
|
FYI, the | is not necessary. You simply need [a-zA-Z].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath Stewart wrote:
FYI, the | is not necessary. You simply need [a-zA-Z].
You are correct, and I mentioned it wasn't required in my answer. I was quoting the OPs regex in the first line.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi guys,
Basically i want to convert the System.Drawing.Image object which is created from BitMap basically from a bit map file to another Image Object of JPEG format. I dont want to use the files for saving intermediately.
can u guys help me in this regard?
thanks,
vinod
|
|
|
|
|
It's as simple as calling the Save method on the Image object.
Image img = Image.FromFile(@"C:\SomeDir\SomeImage.bmp");
if(img != null)
img.Save(@"C:\SomeDir\SomeImage.jpg");
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi Nick,
i dont want to save to another file. I want an image object of jpeg format without saving. Thats what i need.
eligeti
|
|
|
|
|
|
Then just modify Nick's example to save to a MemoryStream instead of a filename.
Keep in mind, however, that whenever you read in an image a bitmap (in the general sense) exists in memory. Some functionality does not work for indexed images, however, because they maintain a separate palette and work a little different.
So, once you've read, say, a .bmp file into a Bitmap object you've it doesn't matter in what format it is, really. To what end is "saving" (or re-encoding) the image if the in-memory data is still the same?
If you're trying to read EXIF headers from a JPEG, then you'll need to re-encode and save it to a MemoryStream so that you can read the headers manually. If that's what you're trying to do, also keep in mind that the .NET Framework has limited support for EXIF already. See the PropertyItem class and the Image.PropertyItems property in the .NET Framework SDK for more information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Use the overload of the Save method that accepts a Stream and an ImageFormat as parameters. You can then call Image.FromStream to retrieve the new Image .
Charlie
if(!curlies){ return; }
|
|
|
|
|
I would like to have a thread that runs only when the system is idle, and yields when other threads are ready to run. How could I do this?
Thanks
|
|
|
|