Article View: borland.public.cppbuilder.nativeapi
Article #8145Re: Writing a new class
From: Ed Mulroy [TeamB]
Date: Fri, 19 Nov 2004 02:41
Date: Fri, 19 Nov 2004 02:41
61 lines
3012 bytes
3012 bytes
There are a few details missing in your description of
what you are doing so I have to guess.
The beginning of your message reads as if you want data
specific to the individual window.
When you registered the window class you specified a
number for the per-window extra data. If you used a
window class registered by something other than your
code then it could already be using that.
The two ways I have used to associate data with a
given window is to place the address of a structure in
the user data area with either
SetWindowLongPtr(hwnd, GWLP_USERDATA, addr value);
or
SetWindowLong(hwnd, GWL_USERDATA, value);
Or to assign to the window a property whose associated
property value is the address of the data structure.
SetProp(hwnd, string or atom, addr value);
I like the user data way better because SetProp has
additional overhead as well as the need for code to
remove it before or during the processing of the
WM_DESTROY message.
The end of your message has this which kind of implies
that you want the data to be common to all windows of that
class, but the SetWindowLongPtr you mention is not
appropriate for doing that.
>Each time I create a window I need to add to
>my list in the WM_CREATE event?
. Ed
>Bob Piskac wrote:
>I am trying to set some local variable with
>SetWindowLongPtr. I assumed each time I create a
>window that I would have a new cbWndExtra pointer.
>It appears that I am wrong and there is just one
>pointer on the original class that gets created.
>Am I right?
>
>If I want a local variable for each window, do I
>have to create a list of variables on the main class
>and link it with the window handle of each
>window?
>
>Example
>
>struct stWindowData{
> HWND hWnd,
> HBITMAP hBitmap;
> struct stWindowData *next;
>};
>
>Each time I create a window I need to add to my list
>in the WM_CREATE event?
Technical Details
Message-ID:
<419d6b51@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!news.cambrium.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<419d5550@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7365b8f9d6c577e1 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Sender: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Reply-To: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Subject: Re: Writing a new class Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 24.74.175.102 References: <419d5550@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <419d6b51@newsgroups.borland.com> Date: 18 Nov 2004 19:41:05 -0700 X-Trace: newsgroups.borland.com 1100835665 207.105.83.66 (18 Nov 2004 19:41:05 -0700) Lines: 62 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!news.cambrium.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail