Solved

send key strokes to other applications when machine is locked

Posted on 2011-02-17
7
504 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now