Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Getting the graphicobject for a given window handle

3 posts in Powerscript Last posting was on 2009-11-12 09:15:26.0Z
Frerich Raabe Posted on 2009-11-11 15:01:30.0Z
Sender: 3fa3.4afacd6f.1804289383@sybase.com
From: Frerich Raabe
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Getting the graphicobject for a given window handle
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4afad1ca.4036.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 11 Nov 2009 07:01:30 -0800
X-Trace: forums-1-dub 1257951690 10.22.241.41 (11 Nov 2009 07:01:30 -0800)
X-Original-Trace: 11 Nov 2009 07:01:30 -0800, 10.22.241.41
Lines: 17
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27156
Article PK: 793589

Hi,

is there a way to get the graphicobject, if any, which
corresponds to a given window handle (a native HWND handle)?

So far, I'm trying to iterate over my objects and call the
Handle() function on each of my objects, but this is not
only rather slow but also error prone, since I have a hard
time getting a complete list of my objects (toplevel objects
are not in that list, as it is).

I suspect that PowerBuilder has a graphicobject -> HWND
mapping internally, which the Handle() function uses; I
wonder whether there's some other way to access it, so that
I can perform a HWND -> graphicobject mapping.

- Frerich


Jeremy Lakeman Posted on 2009-11-12 08:56:37.0Z
From: Jeremy Lakeman <jeremy.lakeman@gmail.com>
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Re: Getting the graphicobject for a given window handle
Date: Thu, 12 Nov 2009 00:56:37 -0800 (PST)
Organization: http://groups.google.com
Lines: 33
Message-ID: <ca0fe6cc-f498-4744-811c-4ef79d3242a7@z4g2000prh.googlegroups.com>
References: <4afad1ca.4036.1681692777@sybase.com>
NNTP-Posting-Host: 122.49.174.115
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1258016197 9008 127.0.0.1 (12 Nov 2009 08:56:37 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 12 Nov 2009 08:56:37 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: z4g2000prh.googlegroups.com; posting-host=122.49.174.115; posting-account=euaBtgoAAAC_vDxfsxmpMKlBxHaHpmRS
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!z4g2000prh.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27160
Article PK: 761740


On Nov 12, 1:01 am, Frerich Raabe wrote:
> Hi,
>
> is there a way to get the graphicobject, if any, which
> corresponds to a given window handle (a native HWND handle)?
>
> So far, I'm trying to iterate over my objects and call the
> Handle() function on each of my objects, but this is not
> only rather slow but also error prone, since I have a hard
> time getting a complete list of my objects (toplevel objects
> are not in that list, as it is).
>
> I suspect that PowerBuilder has a graphicobject -> HWND
> mapping internally, which the Handle() function uses; I
> wonder whether there's some other way to access it, so that
> I can perform a HWND -> graphicobject mapping.
>
> - Frerich

Internally each graphical object has a handle value *and* each win32
HWND has a pointer somewhere to the graphical object.

(if you override the on create function you can put the same instance
of a class into the control array of 2 different windows / userobjects
which leads to some bizarre behaviour....)

I *think* the PB Test Automation OLE interface has something like
that, but I have no idea how to call it...

Otherwise you could probably use the pbni hash map implementation you
can download off code exchange to create an index of known objects by
their handles, which would perform much better than iterating through
your known instances for each lookup.


Frerich Raabe Posted on 2009-11-12 09:15:26.0Z
Sender: 6327.4afbcf15.1804289383@sybase.com
From: Frerich Raabe
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Re: Getting the graphicobject for a given window handle
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4afbd22e.636f.1681692777@sybase.com>
References: <ca0fe6cc-f498-4744-811c-4ef79d3242a7@z4g2000prh.googlegroups.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 12 Nov 2009 01:15:26 -0800
X-Trace: forums-1-dub 1258017326 10.22.241.41 (12 Nov 2009 01:15:26 -0800)
X-Original-Trace: 12 Nov 2009 01:15:26 -0800, 10.22.241.41
Lines: 34
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27161
Article PK: 793596


Jeremy Lakeman wrote:
> Internally each graphical object has a handle value *and*
> each win32 HWND has a pointer somewhere to the graphical
> object.

I guessed so, the latter direction would be most interesting
to me. :-)

> I *think* the PB Test Automation OLE interface has
> something like that, but I have no idea how to call it...

Hm do you have some pointers where I can read more about
this
Test Automation interface? I never heard of that before;
just
tried googling for it but that didn't yield anything either.
Is
there some documentation available, or is this a purely
internal thing?

> Otherwise you could probably use the pbni hash map
> implementation you can download off code exchange to
> create an index of known objects by their handles, which
> would perform much better than iterating through your
> known instances for each lookup.

Yes, true. The problem is that I'd need to keep my hash map
synchronized with the actual applications, so as controls
are
created/destroyed, entries from the hash map would need to
be
added/removed.

- Frerich