Article View: comp.os.ms-windows.programmer.misc
Article #2897Sending keystrokes to Win95 Dos-box
From: Andy Kriechhammer
Date: Wed, 27 Dec 2000 19:21
Date: Wed, 27 Dec 2000 19:21
46 lines
2763 bytes
2763 bytes
follow up to: comp.os.ms-windows.programmer.misc How can I send keystrokes to a Console (DOS) application under Win95? keybd_event() doesn't work in Win 95 for Dos-Boxes, although it works under NT4.0. I tried the following: // bring console window to foreground SetForegroundWindow(hGblForeGroundWindow)) // Get app process and thread id intMyThreadID = GetWindowThreadProcessId(Application->Handle, &intMyProcessID) ; // Get console process and thread id intToThreadID = GetWindowThreadProcessId(hGblForeGroundWindow, &intToProcessID) ; // Attach console window thread to app AttachThreadInput(intToThreadID, intMyThreadID, TRUE)) SendMessage(hGblForeGroundWindow, WM_CHAR, Key, lParam) instead of calling SendMessage() I tried it with keybd_event() called two times, first for keydown, than for keyup. It only worked under NT4.0, not under Win95 :-( SendInput() may work under 98, but I need a solution for 95. The good old recorder.exe, digged out from Win 3.11 is able to send a recorded macro containing keystrokes to a Dos-Box, therefore I suppose, this must be able using just the 16-Bit API. Any suggestions will be appreciated TIA Andy -- Andy Kriechhammer http://members.aon.at/kri OE3ARC KLE500
Technical Details
Message-ID:
<92dfrs$6nicd$1@ID-43780.news.dfncis.de>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news-x.support.nl!newspeer.clara.net!news.clara.net!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!m119p023.dipool.highway.telekom.AT!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 112bcc,956e14a81c3fca3b,start X-Google-Attributes: gid112bcc,public X-Google-Thread: 103bde,956e14a81c3fca3b,start X-Google-Attributes: gid103bde,public X-Google-Thread: 113dfb,956e14a81c3fca3b,start X-Google-Attributes: gid113dfb,public X-Google-Thread: 105df1,956e14a81c3fca3b,start X-Google-Attributes: gid105df1,public X-Google-Thread: fd2c4,956e14a81c3fca3b,start X-Google-Attributes: gidfd2c4,public X-Google-ArrivalTime: 2000-12-27 11:28:02 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news-x.support.nl!newspeer.clara.net!news.clara.net!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!m119p023.dipool.highway.telekom.AT!not-for-mail From: "Andy Kriechhammer" <andy.kriechhammer@gmx.at> Newsgroups: comp.os.ms-windows.programmer.misc,comp.os.ms-windows.programmer.win32,borland.public.cpp.winapi,microsoft.public.win16.programmer.kernel,microsoft.public.win32.programmer.kernel Subject: Sending keystrokes to Win95 Dos-box Followup-To: comp.os.ms-windows.programmer.misc Date: Wed, 27 Dec 2000 20:21:51 +0100 Lines: 48 Message-ID: <92dfrs$6nicd$1@ID-43780.news.dfncis.de> NNTP-Posting-Host: m119p023.dipool.highway.telekom.at (62.46.4.215) X-Trace: fu-berlin.de 977945280 7063949 62.46.4.215 (16 [43780]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400