Board index » delphi » Help needed: keyboard stuffer for windows

Help needed: keyboard stuffer for windows

Hi guys,

I need a method or procedure that can send keystrokes to the windows of a
particular Windows 3.1 application.

Basically, the program I want to make will read a text file, send the text
file as keystrokes to a particular windows, and inserting some formatting
keys (Tab and Ctrl-Enter). I believe this has something to do with
Message, but since I never do any API, an example, even the trivial one,
will be valuable.

Although I hope to tackle this using Delphi 1 or BP7, any other solution
is OK (e.g. make program that creates a Windows Recorder file).

Thank you very much before hand.  I'm so desperate for this...

--
-Eddy Wibowo

 

Re:Help needed: keyboard stuffer for windows


Quote
Eddy (ew4...@harrier.fen.bris.ac.uk) wrote:
> I need a method or procedure that can send keystrokes to the windows of a
> particular Windows 3.1 application.

Now I know that I have to use "SendMessage" instead of "SendAppMessage".

Although I've not seen any follow up here, but, thanks if you planned to
help me.

--
-Eddy Wibowo

Re:Help needed: keyboard stuffer for windows


Eddy <ew4...@harrier.fen.bris.ac.uk> wrote in article
<E4484G....@fsa.bris.ac.uk>...

Quote
> I need a method or procedure that can send keystrokes to the windows of a
> particular Windows 3.1 application.
> Basically, the program I want to make will read a text file, send the text
> file as keystrokes to a particular windows, and inserting some formatting
> keys (Tab and Ctrl-Enter). I believe this has something to do with

The only way to do this really good is the SetWindowsHookEx with the journal
hooks.
The MacroRecorder from Windows 3.1 works this way.

Quote
> Message, but since I never do any API, an example, even the trivial one,
> will be valuable.

It's extremely tough. I guess you can find examples on the microsoft site (in
C, but easy to understand).

Quote
> Although I hope to tackle this using Delphi 1 or BP7, any other solution
> is OK (e.g. make program that creates a Windows Recorder file).
> Thank you very much before hand.  I'm so desperate for this...

A few words:
Might not work on NT, Win95; especially when tampering non-Win3.1 programs.

You could try SendMessage or PostMessage. It's hard to find out which window
exactly processes this message, an easy way to find out is SetFocus() to the
main window, and then find out which window actually got focus using
GetFocus().
You can find out the main window using FindWindow().

Be careful with both SendMessage and PostMessage.
SendMessage to another program will deadlocks your system if the other program
displays a dialog or messagebox (or other stuff, but these are rare). Eg if you
try shutting down NOTEPAD by sending WM_CLOSE to it's main window will lock up
windows if NOTEPAD tries to come up with a messagebox 'File is changed Save?'
PostMessage adds messages to it's message queue. This queue can fill up. After
posting a message, you should enter a so-called PeekMessage loop to let other
programs flush their message queues.

All this might not work under Win95 or NT / both systems hide other running
programs better than Windows 3.1.

For what it's worth, all these solutions are not recommended - no matter what
you do, it'll always be a hack. There are two official "solutions" for making
programs work together: DDE and OLE2.

Anyway,
Good luck.

--
  Zweitze de Vries
  Cyco Software
  Rijswijk ZH, Netherlands

Other Threads