Solved

send key strokes to other applications when machine is locked

Posted on 2011-02-17
7
522 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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

763 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