Article View: borland.public.cppbuilder.nativeapi
Article #9469Re: Callback function as method class
From: Eelke Klein
Date: Fri, 09 Jul 2004 07:22
Date: Fri, 09 Jul 2004 07:22
16 lines
1612 bytes
1612 bytes
Sam wrote:
> I need to drop this callback function as a method of a custom C++ class:
> LRESULT CALLBACK NewWindowProc(HWND hWnd, UINT msg, WPARAM w, LPARAM l)
> {
> ...
> return CallWindowProc(OldProc, hWnd, msg, w, l);
> }
> The compiler refused. It seems that a class can't has a callback as method,
> that is right ?
Yes
Windows callback functions should be normal functions or static member
functions. Normal member functions won't work because they have an
additional hidden parameter which is the object on which they are called.
Eelke
Technical Details
Message-ID:
<40ee47c8$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40ee3b69@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,68c63a4b5ad1dd83 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 09 Jul 2004 09:22:39 +0200 From: Eelke Klein <e.klein@mplussoftware.nl> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Callback function as method class References: <40ee3b69@newsgroups.borland.com> In-Reply-To: <40ee3b69@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 81.58.1.162 Message-ID: <40ee47c8$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1089357768 81.58.1.162 (9 Jul 2004 00:22:48 -0700) Lines: 16 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail