🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11664

Re: creating an event

#11664
From: Bob Gonder
Date: Wed, 28 Jan 2004 18:15
40 lines
2587 bytes
Jim Taylor wrote:

>evolutionary order.) This was simple to do, but I wrote the old part of the
>program to accept "Enter" as a way of beginning the search for the bug in

How do you determine that Enter has been pressed?
Are you using cin, or getch, or is it a message handler (WM_KEYDOWN)?
Also, is this a console or GUI? I assume GUI.

If using getch(), use ungetch().

If using cin, someone who knows C++ will need to step in.

If using full gui, and processing messages... Look in your code to see
which message you use to trigger the Enter handling, and use
PostMessage to send yourself that particular message.

> pressing "Browse up" I next must press
>"Enter". It works well, but I am wondering if I can press "Enter" with a
>line of code.
>
>Were I rewriting the program what I want would be simple. What I want to do
>is add a line and eliminate a keystroke. Too, I am curious about how I can
>do this; it has never come up before.

I use this code in my console app to send myself an Enter.

KEY_EVENT_RECORD	EnterKeyEvent = {TRUE,1,0x0d,0x1c, 13,0};
INPUT_RECORD		input_record;
DWORD			w;
input_record.EventType = KEY_EVENT;
input_record.Event.KeyEvent = InsertKeyEvent;

WriteConsoleInput( GetStdHandle(STD_INPUT_HANDLE), &input_record, 1,
&w);

Don't know if it would work with the cin and getch functions.

You could send WM_KEYDOWN like this:
PostMessage(YourHWnd,WM_KEYDOWN,VK_RETURN,(0x1c<<16) );
Technical Details
Message-ID: <uvsf10dn1r2h576pnr9c42v9ib11k9schm@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4017abaa@newsgroups.borland.com> <olbf10lh2ueh134395g90juvb0gcq33dd4@4ax.com> <4017bfa5@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d5a41e05e4e195c
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-28 10:28:17 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: creating an event
Date: Wed, 28 Jan 2004 10:15:15 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <uvsf10dn1r2h576pnr9c42v9ib11k9schm@4ax.com>
References: <4017abaa@newsgroups.borland.com> <olbf10lh2ueh134395g90juvb0gcq33dd4@4ax.com> <4017bfa5@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.165.30
X-Trace: newsgroups.borland.com 1075313717 67.31.165.30 (28 Jan 2004 10:15:17 -0700)
Lines: 42
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail