🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Control pointer from window handle

#12919
From: Remy Lebeau (TeamB)
Date: Thu, 06 Nov 2003 09:38
20 lines
1882 bytes
"Ivan Johansen" <NG5@Padowan.remove.dk> wrote in message
news:3fa77bef$1@newsgroups.borland.com...

> It can't. There is no relation from the handle to
> the TDBGrid instance.

Actually, there is, but only for VCL apps.  Every VCL control derived from
TWinControl uses the Win32 API SetProp() function to store the VCL 'Self'
pointer (aka 'this') into the HWND specifically for the purpose of being
able to retrieve the pointer from the HWND later on.  Have a look at the
VCL's FindControl() function for extracting the TWinControl pointer from a
HWND.  However, this will not work for non-VCL apps at all, and I do not
know if the TWinControl pointer will be viable from a hook DLL.  It will
probably work as long as FindControl() is called in the context of the
target VCL app.  However, any RTTI-based operations (dynamic_cast, Assign(),
etc) will not work correctly across the DLL boundary.


Gambit
Technical Details
Message-ID: <3faa15d0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fa70ef0@newsgroups.borland.com> <3fa77bef$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,eb9c48fffbb335b9
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-06 01:39:12 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3fa70ef0@newsgroups.borland.com> <3fa77bef$1@newsgroups.borland.com>
Subject: Re: Control pointer from window handle
Date: Thu, 6 Nov 2003 01:38:21 -0800
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.137.149
Message-ID: <3faa15d0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1068111312 67.22.137.149 (6 Nov 2003 01:35:12 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail