|
you could stop the timer when it ticks, and start it again when the elapsed handler has finished; that would give idle periods of your choice and no overlaps.
in order to keep a steady pace, you could calculate the next interval you want to have, based on the current time when the handler starts and ends.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Hi,
What I want briefly is: for example I want to enter "erun" from keyboard and I want internet explorer to run or I want to enter "thk" from keyboard and I want it to be converted "thank you ver much, it's very usefull ... " string. for a programmer it will be very useful to get a long string with a few letters.These were simple examples.
I can use user32.dll but I've tried and couldn't find the way to get letters on this way. It's just running as shortcuts and this way if I assign all letters as shortcut to get them and combine as I wanted they are not be able to entered on the screen then.
Is there any other way or is there any way to do that?
thanks in advance .
|
|
|
|
|
kubibay wrote: What I want briefly is: for example I want to enter "erun" from keyboard and I want internet explorer to run or I want to enter "thk" from keyboard and I want it to be converted "thank you ver much, it's very usefull ... " string. for a programmer it will be very useful to get a long string with a few letters.These were simple examples.
I can use user32.dll but I've tried and couldn't find the way to get letters on this way. It's just running as shortcuts and this way if I assign all letters as shortcut to get them and combine as I wanted they are not be able to entered on the screen then.
Hello!
That's a vague query. I think that you are wanting to build a program, which will replace stuff as you type, on-the-fly (you will type the short form and the program will expand it)?
You will first need to tell us if you need this kind of functionality *just* in your application, or on the whole of the computer. If you wanted your app to perform this kind of task on the whole of the system, the problem is way more complicated than you think it could be. You will need a keyboard hook which will be listening to the keystrokes. And the listening module must be brilliant enough to know if I type "th" in notepad and "k" in excel. And on the other hand, how are you planning to put text into the window that is active ("thank you very much" in place of "thk"). How are you going to select "thk" and "replace" it with the new stuff? What if I start pressing keys in a window which has no typeable area? I can go on asking questions, but what the...
I've done the whole of this stuff before (I worked for a linguistic software firm, wrote a couple of input assistance engines which will predict words from a different language than what's the current one, based on the keyboard input and the current app configuration settings), but I doubt that you will be able to do something of this sort if you don't even know what's all is involved in this.
Ambitious project, sir. However, if you're dead serious, I'd like to tell you that this kind of an app is a perfect candidate for a native language programming language like C++. I shall assist you in that case.
It might also be that I *completely* misunderstood your query, but this is all I am able to make out from your question.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
First the project will be a windows project and will run on the taskbar as notify icon(maybe you can maximize if needed).
I am able to run : for example if I enter "Control + I" from explorer I can run Internet explorer or
If I enter "Control+T" from keyboard anywhere on the screen (it's not necessary any typeable area, you can type anywhere) I can convert it("Control+T") to "Thank you very much... ".
You can see the code sample here: http://www.pinvoke.net/default.aspx/user32.RegisterHotKey[^]
But it's working as shortcut so if:
I use letters for shortcut then I will not be able to enter them to the screen because of they're shortcut.
I want to enter "erun" anywhere in screen even not typeable area and want to run Internet explorer by program.
Is it possible?
|
|
|
|
|
kubibay wrote: Is it possible?
Did you read my reply to you before you posted this? I said that you will need to hook to the keyboard. If you don't know what this means, I shall not be able to help you. I also insist that if at all you go about doing this, do it in C/C++ as this is a clear candidate for native language programming.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Sorry, I don't know what hook means! also C/C++ !
Can you send me a referral link about it?
maybe I can try !
|
|
|
|
|
Information on hooking[^]
C[^]
C++[^]
Both are computer languages with similar syntax's, infact C++ was developed to extend and enhance the C language. Both are native languages.
This is an example of a Keyboard hook[^] written in C#. You can use the logic here to apply to your model.
The reason why I bothered to gather all this info? It will be useless to you, I sense you need a beginners book before attempting to understand global hooks. If you don't even know what C/C++ is, then you're in big trouble.
Good luck, you're going to need it.
|
|
|
|
|
this sample will be very helpful I think,
I know C# well, but I didn't mean that I don't know C/C++ I just meant I'm not familiar with that languages.
thanks for your help
|
|
|
|
|
How does this:
using (MyObj myObj = new MyObj(); ) {
myObj.DoSomething();
}
differ from this?:
{
MyObj myObj = new MyObj();
myObj.DoSomething();
}
I have been using the latter and I'm just wondering if it is more correct to use the former?
|
|
|
|
|
using can only be used on IDisposable implementing objects, and will call Dispose at the end. The other just quietly lets the object die. using can release the objects memory faster if the object would otherwise need to be finalized before collection (correct implementations of Dispose should call GC.SuppressFinalize )
It's usually best to use using whenever possible, especially on things like Stream s and Bitmap s.
|
|
|
|
|
It's not so much a case of correctness, as necessity.
The difference is that when the "using" code block goes out of scope, the resources used are immediately disposed. MSDN on using[^]
In the second case, they will be disposed when the garbage collector feels like it.
For example, if you open a file for exclusive access, then use using. If you don't, then the file may not be completely freed and released by the time you next come around to opening it, and you could get a "file in use" exception, despite you having let go of the file four routines back.
Don't go overboard with using, but if it is a scarce resource, or similar, the using is the way to go.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
There is also at least one case (SearchResultCollection) in which you must dispose manually an object to avoid memory leaks.
|
|
|
|
|
I'm reading text from a SerialPort that begins and ends each message with a newline character. The following code causes the console to display the message:
<br />
while (port.BytesToRead == 0) ;<br />
Console.WriteLine(port.ReadLine());<br />
Console.WriteLine(port.ReadLine());<br />
But this code causes the console to display nothing, and in fact the program hangs on the second ReadLine() :
<br />
while (port.BytesToRead == 0) ;<br />
port.ReadLine();<br />
Console.WriteLine(port.ReadLine());<br />
It seems that some kind of delay (sleeping the thread for a few tenths of a second, writing anything to the console, even setting a break point!) is necessary to make consecutive ReadLine()s execute properly. My understanding of ReadLine() is that it blocks and waits until a newline character appears in the buffer, which is inconsistent with what I'm observing. I've even tried to just clear the first newline character with a Read() or ReadChar(), but the same problem occurs.
Note: the reads need to be synchronous because the serial port data affects my program's logic. I'm not just printing to console/textbox.
|
|
|
|
|
hallo,
I need to create a new application using Visual studio .net (C#) but the boss want an attractive interface with animation and so on. can anyone give me some ideas about the product to use?
thank you very much
|
|
|
|
|
Use WPF if you are using .Net 3.0 or 3.5.
|
|
|
|
|
You can try out the following link to sart with Visual Studio 2008 -
http://msdn.microsoft.com/en-us/vstudio/default.aspx[^]
I can suggest you to use some 3rd party product for rich user interfaces. Among them DevExpress is a very good produc per my experience. There are several other products also availble which you can use based on your requirement,cost etc.
Btw, welcome .NET world 
|
|
|
|
|
ty very much! The library wfp is exactly what i'm looking for.....
|
|
|
|
|
Hi,
I need to change dynamically one parameter value of this attribute : SoapRpcMethodAttribute.
My goal is to extract an Action identifier and put it in the SOAP Message to send.
Do you have some other ideas.
I will very appreciate.
Reda.
|
|
|
|
|
Hi, I use the standard webbrowser control (not the extended version that is available here) (.net framework version is 3.5) in my C# application. When I input data in a text field a javascript function checks that input and displays a YES/NO Messagebox based on that input. Is there any way to get the Dialogresult of that messagebox (i.e. what button was pressed) or better yet a way to intercept this event in order to display my own messagebox?
|
|
|
|
|
I think you are using confirm() function. If not then try out the following -
<html>
<head>
<script type="text/javascript">
<!--
function confirmUserInput() {
var ans = confirm("Are you sure?")
if (ans){
alert("Thank you for your answer")
}
else{
alert("Please made your mind first")
}
}
</script>
</head>
<body>
<form>
<input type="button" onclick="confirmUserInput()" value="Confirmation">
</form>
</body>
</html>
|
|
|
|
|
It's possible to print a form (in format A4) with all controls included in it as the form appear on the desktop ? without manual creation of a specific PrintDocument.
Is there a class that realize this print ?
|
|
|
|
|
why can't you use PrintDocument?
it's as simple as this[^]
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
thanks...it's perfect. But the quality of the print it's low quality.
|
|
|
|