Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 08:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# WPF select/focus notepad

Discussion on C# WPF select/focus notepad within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2012
Posts: 370
Received Thanks: 20
C# WPF select/focus notepad

Hello,
today i wanted to try and make an WPF application that after i click a button it selects an open notepad and sends keys to it...

i googled and found this:

and if i just copy paste that into my app, it gives me errors
can anyone please explain me how this works and how i can make my button select the already oppened notepad and send the keys to it (A,enter,B,enter,C)

this is what i have so far:
Code:
      private void button1_Click(object sender, RoutedEventArgs e)
        {

            SendKeys.Send("{A}");
            SendKeys.Send("{ENTER}");
            SendKeys.Send("{B}");
            SendKeys.Send("{ENTER}");
            SendKeys.Send("{C}");

        }
Hikarim is offline  
Old 12/20/2014, 16:51   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
I think you forgot the using statements which are necessary to access SendKeys.
Before you send the keys make sure that you actually activate the window, otherwise you'll be sending these keys to your own window.
alpines is offline  
Old 12/20/2014, 17:31   #3
 
elite*gold: 0
Join Date: Apr 2012
Posts: 370
Received Thanks: 20
Quote:
Originally Posted by alpines View Post
I think you forgot the using statements which are necessary to access SendKeys.
Before you send the keys make sure that you actually activate the window, otherwise you'll be sending these keys to your own window.
i have them above, this is just the button function, thats what im asking, how do i activate another window?
Hikarim is offline  
Old 12/20/2014, 17:36   #4


 
elite*gold: 1091
Join Date: Jun 2007
Posts: 19,836
Received Thanks: 7,180
Quote:
Originally Posted by Hikarim View Post
i have them above, this is just the button function, thats what im asking, how do i activate another window?
Took me 3 seconds to google that:

They even refer to notepad, please at least show some effort before asking questions.
Mostey is offline  
Old 12/20/2014, 17:54   #5
 
elite*gold: 0
Join Date: Apr 2012
Posts: 370
Received Thanks: 20
Quote:
Originally Posted by Mostey View Post
Took me 3 seconds to google that:

They even refer to notepad, please at least show some effort before asking questions.
How about you read my post? how about that? -I even linked the same link you did, and i said it doesnt work for me, so please...learn to read.
Hikarim is offline  
Old 12/20/2014, 18:30   #6



 
Menan's Avatar
 
elite*gold: 0
The Black Market: 169/0/0
Join Date: Sep 2008
Posts: 9,483
Received Thanks: 3,111
It's not the same link bro!
Menan is offline  
Old 12/20/2014, 19:44   #7
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Quote:
Originally Posted by Hikarim View Post
Same basic code... if you dont have an answer to my question dont post! Bunch of douchebags
I'd count you to those too becasue you're not trying to be helpful to solve your problem.

Many basic problems are already solved 1000 times and more so why don't you google it?

Not to forget: You say the snippet you copied crashes and displays errors. Why don't you show us the errors?
alpines is offline  
Old 12/20/2014, 19:52   #8


 
elite*gold: 1091
Join Date: Jun 2007
Posts: 19,836
Received Thanks: 7,180
Quote:
Originally Posted by Hikarim View Post
Same basic code... if you dont have an answer to my question dont post! Bunch of douchebags
It's a different implementation, ShowWindow and SetForegroundWindow are different functions and besides that, the examples do not contain the same "basic" code. But yeah, however. The douchebags trying to help you are not getting anything in reward but insults from you. I wouldn't be surprised if nobody wants to help you.
Mostey is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Help with notepad++
03/06/2012 - Web Development - 1 Replies
Hey guys if i have my code and i want to edit the text , just the text not the html code for do it more fast how can i " hide " the html text and just see the normal text? if you follow me well say me it please!! Thanks!!
Notepad++
10/03/2011 - Metin2 Private Server - 1 Replies
Wie kann ich mit Notepad++ oder einem anderen Editor einen Teil in einer Zeile der in anderen Zeilen auch vorkommt alle auf einmal zu löschen
Metin 2 Select Character select error
02/26/2011 - Metin2 Private Server - 1 Replies
Dabei-ist das spiel Charakter-Auswahl Error help Log Files 0225 23:37:16227 :: CEffectManager::RegisterEffect - LoadScript(d:/ymir work/effect/hit/percent_damage1.mse) Error 0225 23:37:16227 :: CInstanceBase::RegisterEffect(eEftType=264, c_szEftAttachBone=, c_szEftName=d:/ymir work/effect/hit/percent_damage1.mse, isCache=1) - Error 0225 23:37:16227 :: CEffectManager::RegisterEffect - LoadScript(d:/ymir work/effect/hit/percent_damage2.mse) Error 0225 23:37:16227 ::...
Notepad++ !! ?? !!
02/21/2011 - Metin2 Private Server - 0 Replies
hey kann mir einer sagen wie ich es schaffe das es bei notepad++ so ausihet will den dss switch bot von Kamer1337 einbauen aber es kommen nur chinazeichen wen ich mit notepad++ öffne... Mfg der zweite punkt... game.py wo finde ich die??? Punkt 1. Entpackt die Root Punkt 2. Öffnet die game.py Punkt 3. Setzt einen Hotkey-> PHP-Code: onPressKeyDict = lambda : self.StatsChangerStart() Punkt 4. Dann die Funktion setzen:
I need help with NotePad!
04/06/2008 - Off Topic - 1 Replies
http://i31.tinypic.com/2nursd3.png http://i31.tinypic.com/2zodw8w.png http://i27.tinypic.com/ra84ys.png



All times are GMT +2. The time now is 08:04.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.