🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Function Address Help

#8189
From: Alistair
Date: Sun, 14 Nov 2004 15:18
39 lines
2008 bytes
I have solved my problem :

SetWindowLong(WndInfo->WindowHandle, GWL_USERDATA, (long)this);

After creating the window in my class, I simple pass the address of the 
instance to the window,
then when the static WNDPROC is called I simply do :

MyWindow *curWnd = (MyWindow *)GetWindowLong(hWnd, GWL_USERDATA);

I can now refer to curWnd knowing its the correct instance! I have create 5 
windows as the same time
and they all process their own messages correctly!

Cheers

Alistair

"Alistair" <Alistair@NoSpam.Sodoff> wrote in message 
news:4197658a$1@newsgroups.borland.com...
> WNDPROC *wndFunc = &MyWindowClass::WndProc; // I realise this is wrong and 
> why
>
> So how do I pass the address of a function, that is within my class, to 
> the windows procedure in RegisterClass ?  Can it be done?
>
> I can pass in a static function, but knowing then which instance of the 
> class that called it....
>
> There must be a way of passing the instance objects function to the 
> RegisterClass so it calls it when a message is sent.
>
> Any ideas welcome.
>
> Cheers
>
> Alistair
>
> 
Technical Details
Message-ID: <4197770c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4197658a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,896683d16cbc3ca2
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Alistair" <Alistair@NoSpam.Sodoff>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4197658a$1@newsgroups.borland.com>
Subject: Re: Function Address Help
Date: Sun, 14 Nov 2004 15:18:18 -0000
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 81.152.249.12
Message-ID: <4197770c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1100445452 81.152.249.12 (14 Nov 2004 07:17:32 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail