Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

send key strokes to other applications when machine is locked

Posted on 2011-02-17
7
Medium Priority
?
535 Views
Last Modified: 2012-05-11
I have a mainframe console interface (win 32 application) which gets automatically logged off after 10 min of inactivity. I am planning to create a small key triggering application in Delphi to send keystrokes to that console interface to make it active forever.

(1) My new application should be able to send automated key-presses to my console interface application.
(2) The new application should be able to send key presses even when the computer is locked.. An this is the important feature i am looking for.

I would love to hear from the Delphi experts here for ideas / code samples etc..
0
Comment
Question by:jimsweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 34914516
Are you talking about creating local application to run on that machine and send the key strokes?
0
 
LVL 8

Author Comment

by:jimsweb
ID: 34914627
yes. jimy.
Create a small Delphi application that can send key stroke (say enter key) to another windows application running in the PC.

NB: Mainframe console interface: It is a windows application that interact with mainframe. Usually mainframes a unix based, though the latest one is running on zOS.
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34914648
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 24

Expert Comment

by:jimyX
ID: 34914674
To send to another window you can use "SendKeys" from the unit "SndKey32.pas":
http://delphi.about.com/od/adptips2004/a/bltip1104_3.htm

But since you just need to keep the session active by simulating a key press, you can just use "PostKeyEx32" by sending a vk_Control key press in a Timer.
I am not familiar with Mainframe console interface or zOS so I am not sure if this works though.
0
 
LVL 24

Accepted Solution

by:
jimyX earned 1600 total points
ID: 34914861
You can set a suitable interval for the Timer (say 7000 ms):
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  PostKeyEx32(VK_CONTROL, [], False);
end;

Open in new window

"PostKeyEx32" can perform the key action on the active application that's why I am not using Enter/Return key because if the focus is moved unintentionally to another application then the key pressed can perform an unwanted actions (if the active application has the possibility to receive Enter on one of its controls).
0
 

Assisted Solution

by:SleekProductions
SleekProductions earned 400 total points
ID: 34924335
I might be wrong here, but I would have tried to:

1. Use WinSpy (part of MSDK?) or similar (you know those apps where you can move the mouse over a window and get its information, intended as debugging tools) to find out how to find the old applications target window in a safe way (that always work), by window class, title or something like that.

2. Posting a message to that window to keep it alive or (worst case) a keystroke (I know nothing about your target).

3. There should also be a way to check that the old app is still running (logged in or not) and if not run the window finding routine again and again until such a window is found.

The aim here being to have an app started when the machine is powered on (windows boots) that needs no attention at all.

Perhaps this task can be helped with things from www.madshi.org.
0
 
LVL 8

Author Closing Comment

by:jimsweb
ID: 34977172
Thanks you..
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question