|
|
Thank u so much Gareth
|
|
|
|
|
Hello,
I do know how Enums work in C#, although I am not sure if the following is possible to do:
public enum Type<br />
{<br />
PRESSED1 = 0x0100,<br />
PRESSED2 = 0x0104,<br />
RELEASED = 0x0101,<br />
}
Here you see that there are two possible values for a PRESSED-event: 0x0100 and 0x0104. Is it possible to create only 1 PRESSED value that contains both 0x0100 and 0x104?
I suppose it's not possible, mainly since it's an assignment of 1 value.
I get these values with a low level keyboard hook. All keys except the Menu-key (Alt-key) give the code 0x0100 with wParam. Only the Menu-key sends a 0x0104 with wParam and I'm not feeling to check if it is 0x0104 to convert it back to 0x0100.
Thanks in advance!
|
|
|
|
|
Well, in binary 0x0100 is: 0000000100000000
and 0x0104 is: 0000000100000100
and 0x0101 is: 0000000100000001
Each bit will probably represent something, the middle bit may mean that the key has been pressed, the first may mean it has been released, and the 3rd might mean that its a special key like Alt or Fn
I'm not sure what you want to do but if you use the enum:
enum Type : int
{
Pressed = 0x0100,
SpecialKey = 0x0004,
Released = 0x0001
}
Then you can AND the values in your enum, with the value that you have, so that you can see what information it contains.
So this statement would return true if the key was being released:
if((myValue & Type.Released) == Type.Released)
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Thank you for your response. In order to make it more clear what I exactly want, here is an example in psuedo-code:
<br />
public enum Type<br />
{<br />
PRESSED = 0x0100 AND 0x0104,<br />
RELEASED = 0x0101,<br />
}<br />
PRESSED has both values 0x0100 and 0x0104. So if when I convert an int to Type, it will either be PRESSED, RELEASED or an int.
I hope my point is clear.
Thank you in advance.
|
|
|
|
|
Then it shoule be like i said. 0x0100 AND 0x0104 = 0x0100, the thing common in both of them is that one bit in the middle.
So if you set up your enumaration like i demonstrated, then you should be able to see if a button has been pressed/released.
What i'm saying is that 0x0104 is not its own value, its a combination of both 0x0100 and 0x0004 each of which represent 1 bit in the int.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Now I see what you are trying to do. Your construction doesn't always work, and in my case it doesn't either (or I am making some stupid mistakes at the moment), because I also have the KEYUP value that's bigger then 0x0100 and giving problems. But I see what you are trying to do and possibly you should use the pipeline/vertical pipe (|) instead of the ampersand (&).
For now I am using a statement to check if it is KEYDOWN2 and then convert it back to KEYDOWN.
Thanks for your time and your vision: it helped me with some other things ^_^
|
|
|
|
|
Yeah, the two values are OR'd togeather to give the final number. And then you AND this number for whichever flag you are looking for, if the result is not zero, that whatever flag you where looking for is there.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Maybe the Flags attribute could help?
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Hi
i've a combobox in which i have to show all the available servers(sql,oracle,etc). if i use SQLDataSourceEnymerator it shows SQL server only.but i need to list oracle,oledb,etc.
can anyone help me?
thanks in advance
shri
|
|
|
|
|
There is no one method to get ALL database servers. Each is going to have it's own method that you're going to have to use. You've already found SQL Server's, now you have to use a library specific to Oracle to get it's list. There is no such thing as an OleDb database server since this is a relatively generic method of access them. If you're refering to MySQL Servers, you'll have to use a library specific to MySQL to get it's server list.
|
|
|
|
|
Hi, I am trying to understand how reflection works dynamically..
For that I am trying to call the Console.WriteLine static method dynamically..
This piece of code works where I call the WriteLine(string) method:
Type console = typeof(Console);
MethodInfo writeLineMethod = console.GetMethod("WriteLine", new Type[] { typeof(String) });
writeLineMethod.Invoke(console, new Object[]{"NewBie0915"} );
However when I try to call the Console.WriteLine(string, object) method, it dosent call it !!
Please tell me why... In the following code, only "Hey" is displayed instead of "Hey NewBie0915!"..
Type console = typeof(Console);
MethodInfo writeLineMethod = console.GetMethod("WriteLine", new Type[] { typeof(String), typeof(Object) });
writeLineMethod.Invoke(console, new Object[]{"Hey ", "NewBie0915!"} );
Does it have problems converting from String to Object? I am not able to understand this..
Any help would be appreciated..
Thanks !!
|
|
|
|
|
Because you missed "{0}" in the string
"Hey {0}"
|
|
|
|
|
Hi,
I have created a certificate both private and public key (created using MS SQL Server, and Visual Studio Tools), which I have imported into the Certificate Store under Trusted People, Machine Level.
I have a program that encrypts sensitive data on that server, using the private/public key.
I kan run the same program to decrypt data encrypted on the same machine, but when I run the program on another computer (using the same private key, in this case the pfk file) I'm getting error when I run decryption.
I also discovered that when I use the certificate store certificate to encrypt, and load the pfk file into my program to use that private key to decrypt the same data I fail to decrypt it.
I'm using .net X509Certificate lib, with RSA provider and CSParameters, on Windows Platform, both XP and windows server 2003.
I have read some worring comments that using certificate store to encrypt data, you have to decrypt this data using the same machine. Would this be the case, I'm not able to find any threads on the internet about this issue.
If there is an issue with encryption/decryption across machines using the certificate store facilities, which method would you recommend to ensure decryptablilty across machines?
I'm writing the code in C#, but it could be any managed code in .net.
Hope some here have some fact and tips in this case.
Thanks,
|
|
|
|
|
From what I have read on using Key Stores you need to access the one one the local machine. That is why I normally store keys in a db or such of my own creation. One of the biggest limitations of PGP, IMHO, is the limited manner in which there key store works; Windows suffers a similar fate.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
how should i dislay the pie chart using c#
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Here[^]
And the first result is from right here at CP.
Imagine that.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson Because programming is an art, not a science. Marc Clifton
|
|
|
|
|
buddy ,
I am able to export data to excel from my dataset, but problem is in displaying the charts to excel from c#.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Pankaj Garg wrote: but problem is in displaying the charts to excel from c#.
In your first post you didn't mention that. So please try to be specific when asking question in this forum.Here every body try there best to give solluation.
Pankaj Garg wrote: I am able to export data to excel from my dataset
now , where do you want to draw the Chart in C# Application or in Excel itself.
as per you question you want to draw chart in Excel,
please correct me if i am wrong.
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
i have data , and pertaining to that , i want to create a excel file for the pie chart.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Hope This will helps you
create Excel graph in c#[^]
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
i need help in c# , code is aailable there in the same language.but in few places, the code is quite confusing, datatype is not declared .i mean code is incomplete.
do u have any other link?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
|
Hi all,
Im having problem with Simple style combobox.
actualy i have a form window with a combobox and other one is Textbox.
combobox style is Simple(CBS_SIMPLE). there is so meny text. when user type some text and hit enter key it will be select current item.
but its nothong happen. user have to press down arrow.
my question is this.
i don't wanna use down arrow key, i want to use enter key to sellect current item.
what its posible to change Keys event?
please give me any idia with small source.
thank you
bir
|
|
|
|
|
Member 4129218 wrote: when user type some text and hit enter key it will be select current item.
where should user , enter the text, is it in the text box?
i think you want, when user give some text in text box and press enter then it should add in combox box and current enterted text should be selected.
Please confirm
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|