🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Sending VK_CONTROL/VK_HOME to a TStringGrid

#17162
From: Remy Lebeau (TeamB)
Date: Tue, 08 Apr 2003 01:56
25 lines
1955 bytes
"nicolasr" <nicolasrNOSPAMATSIGNgmx.net> wrote in message
news:3e921bff$1@newsgroups.borland.com...

> Anything wrong with this?

Yes - you can't send SHIFT, CTRL or ALT keypresses using messages for what
you're trying to do, especially since the VCL is invoved on the receiving
end.  The VCL doesn't get those values from any messages to begin with.  It
uses GetKeyState() instead.

You basically have two options that I can think of (both untested):

1) use GetWindowThreadProcessId(), AttachThreadInput(), GetKeyboardState()
and SetKeyboardState() to set the state of the VK_CONTROL key for the thread
that the TStringGrid is running in.  Then send the message for just VK_HOME
only, and then afterwards reset the keyboard state and detach from the
thread.

2) use a combination of GetWindow(), SetForegroundWindow() and SetFocus() to
make sure the TStringGrid has the input focus, then use keybd_event()
instead of sending messages.


Gambt
Technical Details
Message-ID: <3e922c32$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e921bff$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,298cd03bd48ea3ec
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-08 02:55:41 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e921bff$1@newsgroups.borland.com>
Subject: Re: Sending VK_CONTROL/VK_HOME to a TStringGrid
Date: Mon, 7 Apr 2003 18:56:20 -0700
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e922c32$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049766962 207.175.226.26 (7 Apr 2003 18:56:02 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail