Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 30th, 2007, 1:49 PM   #1
bheesham
Newbie
 
Join Date: Dec 2007
Posts: 8
Rep Power: 0 bheesham is on a distinguished road
Sending keys to a process?

I was wondering if there was anyway to send keys to a process.
For example: Press a hot key and it types something in NotePad.exe with notepad being minimized.

Is there any way to do that?

Thanks in advance.
bheesham is offline   Reply With Quote
Old Dec 30th, 2007, 1:52 PM   #2
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Re: Sending keys to a process?

research "Sendkeys". It's built into the .NET framework, but for vb6 you'll have to make some API calls if I remember correctly.
Booooze is offline   Reply With Quote
Old Dec 31st, 2007, 9:21 AM   #3
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4 mackenga is on a distinguished road
Re: Sending keys to a process?

SendKeys is accessible via the WScript.Shell object too; so in VBScript you can do:

Dim objSH
Set objSH = CreateObject("WScript.Shell")

The most interesting methods will be AppActivate (if I remember correctly) and SendKeys. I've never actually used this in VB6, but I'd guess you add a reference and that lets you create an instance of WScript.Shell to use.

Edit: just checked; yup, it's AppActivate. Googling for the method names will help.
__________________
"I'm not a genius. Why do I have to suffer?"

Last edited by mackenga; Dec 31st, 2007 at 9:24 AM. Reason: Tried out to confirm it worked
mackenga is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
child process - chdir and execXX programmingnoob C 3 Feb 6th, 2007 3:08 PM
Suspending another process in win32 coder0xff C++ 4 May 28th, 2006 11:33 AM
Process injection jayme C++ 3 Jan 28th, 2006 6:05 AM
Forking process using python/Writing daemons thinkgeek Python 5 Jul 5th, 2005 11:46 AM
Sending a web form as parameter see07 C# 4 Mar 24th, 2005 9:25 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:54 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC