| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		newb09 Master Cheater
  Reputation: 0
  Joined: 02 Feb 2007 Posts: 350
 
  | 
		
			
				 Posted: Sat Feb 23, 2008 11:42 am    Post subject: Shortcuts in C# | 
				       | 
			 
			
				
  | 
			 
			
				I need help creating a shortcut key.
 
 
If i pres F2 i want it to show a dialog saying Complete.
 
How can i do this?
 
 
i tried this but it didnt work idk what im doing wrong lol.
 
 
if (e.keycode = 71)
 
{
 
    MessageBox.Show("COmplete");
 
}
 
 
Thank you.
 
 
Lol i never worked with shortcuts until now please help me.
 _________________
 NOOBXOR = Comes from the root words noob and haxor, hence noobxor.
 
word created by: newb09 & ferenzo
 
   | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		samuri25404 Grandmaster Cheater
  Reputation: 7
  Joined: 04 May 2007 Posts: 955 Location: Why do you care?
  | 
		
			
				 Posted: Sat Feb 23, 2008 11:56 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				If you want it to work outside the program, use a keyboard hook (I've shown one in a GP+ post). 
 
 
Otherwise, just do a Form_KeyDown event.
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		newb09 Master Cheater
  Reputation: 0
  Joined: 02 Feb 2007 Posts: 350
 
  | 
		
			
				 Posted: Sat Feb 23, 2008 12:01 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | samuri25404 wrote: | 	 		  If you want it to work outside the program, use a keyboard hook (I've shown one in a GP+ post). 
 
 
Otherwise, just do a Form_KeyDown event. | 	  
 
 
do you have a link if not i can search i got the keydown and i want it to run when another application is running no matter what app it is.
 _________________
 NOOBXOR = Comes from the root words noob and haxor, hence noobxor.
 
word created by: newb09 & ferenzo
 
   | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		samuri25404 Grandmaster Cheater
  Reputation: 7
  Joined: 04 May 2007 Posts: 955 Location: Why do you care?
  | 
		
			
				 Posted: Sat Feb 23, 2008 12:09 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				I don't know quite what you're getting at. 
 
 
Do you mean that you want the application to recieve the keystroke even when it's not being focused?
 
 
If so, you need to use a KeyBoard hook. 
 
 
Otherwise, just go to the Form Designer, select the title bar of your form (to select it as the control), go to the Events (it's a lightning bolt symbol) in the properties, and double click on "Form_Keydown" or something like that.
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		newb09 Master Cheater
  Reputation: 0
  Joined: 02 Feb 2007 Posts: 350
 
  | 
		
			
				 Posted: Sat Feb 23, 2008 12:10 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | samuri25404 wrote: | 	 		  I don't know quite what you're getting at. 
 
 
Do you mean that you want the application to recieve the keystroke even when it's not being focused?
 
 
If so, you need to use a KeyBoard hook. 
 
 
Otherwise, just go to the Form Designer, select the title bar of your form (to select it as the control), go to the Events (it's a lightning bolt symbol) in the properties, and double click on "Form_Keydown" or something like that. | 	  
 
 
yes thats what i meant. receive the key when not focused. So if im running firefox and i press the key it will do what the code says and if im in IE and i press the key it will do that also.
 _________________
 NOOBXOR = Comes from the root words noob and haxor, hence noobxor.
 
word created by: newb09 & ferenzo
 
   | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		samuri25404 Grandmaster Cheater
  Reputation: 7
  Joined: 04 May 2007 Posts: 955 Location: Why do you care?
  | 
		
			
				 Posted: Sat Feb 23, 2008 12:12 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Ok, you need a keyboard hook. 
 
 
Go to the General Programming + section, and check out my post on creating a Static Keyboard Hook in C#.
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		newb09 Master Cheater
  Reputation: 0
  Joined: 02 Feb 2007 Posts: 350
 
  | 
		
			
				 Posted: Sat Feb 23, 2008 12:14 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				ok thanks for your help.
 _________________
 NOOBXOR = Comes from the root words noob and haxor, hence noobxor.
 
word created by: newb09 & ferenzo
 
   | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |