|
If you want to catch the messages, use this in your form class.
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
}
|
|
|
|
|
Hi there......
Thanks for your help. I need to know how to process a WM_CHAR message sent by other application using SENDMESSAGE API.
I want to receive any keyboard stroke. As you suggested I used :
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_CHAR)
MessageBox.Show(m.Msg.ToString());
}
But it gives an error for WM_CHAR. So please tell me how to catch any keyboard event.
Thanks a ton.....
Vishal Moharikar.
|
|
|
|
|
|
Hi there...
Sorry, if I am asking any stupid questions.. but just tell me how would I come to know whether the received message is a keyboard event or any other windows message.
I just want to handle the keyboard messages fired by any other application.
Thanks....
Vishal Moharikar.
|
|
|
|
|
We can use int32.TryPrase("1231312",out tmpInt32Value) for normal situtations.
But the following code,
string outputString = (12345).ToString("ABCDE-0000000000");
I do not have a good idea to read such string ABCDE-0000012345
Especially when the format string is "ABCDE-0066000880"
modified on Tuesday, May 26, 2009 3:09 AM
|
|
|
|
|
and... what is the question ?
|
|
|
|
|
Thank you.
I do not have a good idea to convert string ABCDE-0000012345 to int32
Especially when the format string is "ABCDE-0066000880"
|
|
|
|
|
What kind of strings are that ?
Do you mean :
ABCDE-0000012345 = 12345
ABCDE-0066000880 = 66000880
???
|
|
|
|
|
when the format string is "ABCDE-000066000880";
int 1234 custom formated value is "ABCDE000066123884"
My question is how to get the int value by custom format string "ABCDE-000066000880" and formatted string "ABCDE000066123884".
|
|
|
|
|
Your going to format your interger to a predefine format.
Example 1
<br />
string outputString = (12345).ToString("ABCDE-0000000000");<br />
Example 2
<br />
string outputString = (12345).ToString("ABCDED-0000000000");<br />
If your are expecting that the output of Example 1 is ABCDE-0000012345 you are wrong because "E-0" means Scientific notation.
Note: If any of the strings "E", "E+", "E-", "e", "e+", or "e-" are present in the format string and are followed immediately by at least one '0' character, then the number is formatted using scientific notation with an 'E' or 'e' inserted between the number and the exponent. The number of '0' characters following the scientific notation indicator determines the minimum number of digits to output for the exponent. The "E+" and "e+" formats indicate that a sign character (plus or minus) should always precede the exponent. The "E", "E-", "e", or "e-" formats indicate that a sign character should only precede negative exponents.
See Custom Numeric Format String[^ for more details.
Happing Coding...
|
|
|
|
|
Thank you for your answer.
And ,i made a bad formatted sample. Sorry to everyone.
we know that code (1234).ToString("ABCD-000066000880") 's value is ABCD-000066123884.
And I want to get a int value from string "ABCD-000066123884" and formatted string "ABCD-000066000880"。
|
|
|
|
|
if your string format is constant to have a format like this "ABCD-0000000000", try to split your string to string array then get the second index value and lastly do your Int32.TryParse thing.
string[] myString = ("ABCD-000066123884").Split('-');<br />
Int32.TryParse(myString[1],out intVar);
Happy Coding...
|
|
|
|
|
I think I know what he wants :
That means :
ABCD-000066123884 is not 66123884, but 1234.
If that is the problem, then you must write your own method to parse the string.
|
|
|
|
|
Yes , It is the problem.
|
|
|
|
|
Probably this is what you need:
static int MyOwnParser(string text, string formatter)
{
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < formatter.Length; i++ )
{
if(formatter[i] == '0')
{
stringBuilder.Append(text[i]);
}
}
return int.Parse(stringBuilder.ToString());
}
|
|
|
|
|
I was thinking in the same direction, only without the StringBuilder as intermediate result...
int result = 0;
for (int i = 0; i < formatter.Length; i++) {
if (formatter[i] == '0') {
result = result * 10 + (text[i] - '0');
}
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
This method of int32 convert to string with format,maybe can not reverse.
When the format string contains "#".
From MSDN:
#
Digit placeholder
If the value being formatted has a digit in the position where the '#' appears in the format string, then that digit is copied to the result string. Otherwise, nothing is stored in that position in the result string.
Note that this specifier never displays the '0' character if it is not a significant digit, even if '0' is the only digit in the string. It will display the '0' character if it is a significant digit in the number being displayed.
The "##" format string causes the value to be rounded to the nearest digit preceding the decimal, where rounding away from zero is always used. For example, formatting 34.5 with "##" would result in the value 35.
|
|
|
|
|
how to Know the language of the writing that had been made
thanks
|
|
|
|
|
Pardon?! Please explain in details
|
|
|
|
|
iam Designing a program in C# and i want to know if the user of the program entered the data in english language or arabic for example, so how can i check for that ?
|
|
|
|
|
English won't contain arabic characters, so you could check which unicode range they fall in..
Won't help to distinguish many west european languages from eachother though, perhaps spellcheck would help (the language in which there would be the lowest number of errors would be most likely)
|
|
|
|
|
harold aptroot wrote: the language in which there would be the lowest number of errors would be most likely
Not necessarily. Look at the number of spelling errors in a lot of the posts here that are supposed to be in English.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
That's why I say "is most likely" instead of "is"
But if you're making so many spelling errors.. well.. I would be surprised if it's even possible to detect the language..
|
|
|
|
|
|
Hi Guys,
In Windows, I have to stop the collapse and expand of treeview,when i double clicks on any node.Collapse and Expand should be fire on clicking the + or - sign in the treeview.
Please give the needful answer.....
Regards,
Lalit Narayan
|
|
|
|