Solved

send key strokes to other applications when machine is locked

Posted on 2011-02-17
7
532 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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 400 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 100 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Part One of the two-part Q&A series with MalwareTech.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

615 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