473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

SendKeys to another running application


Hi all
I'm working on Visual C# .NET, I'm new and I want to build on-screen
keyboard, I want to know what should happen when you click a button,
lets say its "A" how should I send the value of it to another running
application, let it be Word or any other programm... I found somthing
about SendKey.Send ... but I donno how to use it, I tried to read some
about it, but they said that I have to use the FindWindow, to find the
active progrram, so that the key is sent to it, but I couldn't find
anything called FindWindow.
Please if you can help me, I would appreciate it ...
Best regards
Batoul

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
4 13023
Hi bat sar,

FindWindow is part of the Win32 API (user32.dll).
You need to put something like this to be able to use it (DllImport is
part of System.Runtime.InteropServies)

[DllImport("user32.dll")]
public static extern int FindWindow(string WindowClassName, string
WindowName);
--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
Hi,

FindWindow is part of the win API you need to P/Invoke it.

Another problem will be find the target window (application), cause when
you are using your keyboard the active application will be your keyboard
application :)

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"bat sar" <to******@hotmail.com> wrote in message
news:Oz**************@TK2MSFTNGP10.phx.gbl...

Hi all
I'm working on Visual C# .NET, I'm new and I want to build on-screen
keyboard, I want to know what should happen when you click a button,
lets say its "A" how should I send the value of it to another running
application, let it be Word or any other programm... I found somthing
about SendKey.Send ... but I donno how to use it, I tried to read some
about it, but they said that I have to use the FindWindow, to find the
active progrram, so that the key is sent to it, but I couldn't find
anything called FindWindow.
Please if you can help me, I would appreciate it ...
Best regards
Batoul

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #3
You're could write something at the lower level...

I believe that you could send a system message that alerts that a
keyboard button has been pressed. Put this in a library, and all you'd
have to do is use P/Invoke to use it. This would essentially be
disguising your app as the keyboard itself.

This would also let you handle things like ALT+TAB and the three finger
salute.
bat sar wrote:
Hi all
I'm working on Visual C# .NET, I'm new and I want to build on-screen
keyboard, I want to know what should happen when you click a button,
lets say its "A" how should I send the value of it to another running
application, let it be Word or any other programm... I found somthing
about SendKey.Send ... but I donno how to use it, I tried to read some
about it, but they said that I have to use the FindWindow, to find the
active progrram, so that the key is sent to it, but I couldn't find
anything called FindWindow.
Please if you can help me, I would appreciate it ...
Best regards
Batoul

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #4

Well, thank you all for help, I tried to use the FindWindow, and
GetForeGroundWindow, and it worked I got the most top running program
other than my keyboard app ...
but the problem here, is finding away to write into this app, I tried to
send the key directly but it didn't work ...
Do any one know how??? I would appraciate it :)
Thanx again
Batoul
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RBohannon | last post by:
I need to create a report in MS Word populated with data from A2K. I have been asked to create the report in Word so that parts of it can be edited as necessary later. The data in the report are...
5
by: Wayne Gibson | last post by:
Hi, Was wondering if somebody could help.. I'm trying to use Sendkeys on a Windows forms. I have entered the following command to simulate a CTRL+ALT+1.. ...
1
by: Bryan | last post by:
I am writing a C# Windows App that updates out Excel reports' modules. The app is complete, but has a problem. The only way MS allows you to unprotect the VBA code in Excel is to do it by hand or...
5
by: Pete | last post by:
I'm trying to use SendKeys to send a 'close' key sequence to an application popup. Unfortunately, I'm running into the classic timing issues with SendKeys at it sometimes hits the wrong app (even...
2
by: Phil Galey | last post by:
I have an application written in VB.NET, running on Windows 2000 SP 3. It uses a process object and AppActivate, followed by SendKeys commands, to control a running QuarkXPress application. On...
4
by: atr2000 | last post by:
How can I perform a SendKeys.Send to the current active application from a windows service? Or is there a different way to do this? I currently receive the following error message: ...
7
by: =?Utf-8?B?Vmlua2k=?= | last post by:
public void sendKeysTest() { Process myProcess = Process.Start(@"C:\winnt\system32\cmd.exe"); SetForegroundWindow(myProcess.Handle); if (myProcess.Responding) SendKeys.SendWait("{ENTER}");...
5
by: =?Utf-8?B?U3JpbWFu?= | last post by:
Hi, We are launching .net window from vb6 form. In .net form tabbing(tab out from one control to another control) was not working. for that i have written a code like Sendkeys.send("{TAB}") in the...
0
by: jairathore | last post by:
Hi, I m working on a project on which my requirment is like that remotely i control another application by using sendkey.sendwait method, i m sending some keystroke to that application and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.