Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi users,

I am working on a window application in c# in which I need to trap keyboard keys.

My problum is, I want to make window forms invisible at run time but I still want that everything should work same as it will work when form is viSible.

Can someone please help me?
Posted
Updated 16-Sep-10 21:26pm
v5
Comments
senguptaamlan 16-Sep-10 5:32am    
please, change the tag from...as per your question it seems that your application is windows based..then tagging it as ASP.NET is misguiding
Dalek Dave 17-Sep-10 3:26am    
Edited for Grammar and Readability.

You can use javascript onkeypress event for this,

http://www.w3schools.com/jsref/event_onkeypress.as[^]
 
Share this answer
 
Comments
Dalek Dave 17-Sep-10 3:27am    
That's what I would have suggested!
In other words you trying to make a keylogger?
Try using

myForm.ShowInTaskbar = false;
myForm.Opacity = 0;


C#
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
    //Capture the key event and write to text file
}


This will only work though when the form is in focus.
Check the following link for additional info.
Keylogger
 
Share this answer
 
v2
Comments
pawanvats 16-Sep-10 7:32am    
ok,now my form is invisible,
but problum is still there,
even now i can't perform any action in my application........
Bardy85 16-Sep-10 7:41am    
You trying to capture the keyboard event correct? Otherwords key strokes?
What actions are you trying to get your application to preform?
pawanvats 17-Sep-10 2:00am    
sir i mean to say ,by using ur suggestion , i can hide mY form .but i can't perform the operation like capturing keyboard events etc.
i want to hide my form but at run time i should be able to handle keyboar Events.
Dalek Dave 17-Sep-10 3:27am    
Good Call.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900