Article View: borland.public.cppbuilder.nativeapi
Article #8085Re: Help needed in Type Casting
From: Ed Mulroy [TeamB]
Date: Mon, 22 Nov 2004 04:05
Date: Mon, 22 Nov 2004 04:05
47 lines
2390 bytes
2390 bytes
A structure definition is a type. You can then declare or allocate one or more instances of a type. While for efficiency only one set of physical instructions is generated for a member function of a structure, the manner in which the function is called includes specifying which instance of the type those instructions are to work with. You specified a member function of a structure to Windows as a callback function. Windows is not party to the internal configuration of your program and has no facilities to call a non static member function in the context of whatever instance of that structure you intended to be used. Only static member functions and normal functions that are not members of a class or structure can be specified as callback functions. . Ed >FireHead wrote: > >... >As you can see that I have function called LRESULT >CALLBACK Events(....) >which globally located. > >I have function called InitInstance which is part of >Main_Window structure. > >Where I declare WNDCLASSEX wnd >and then I declare the expression >as << > wnd.lpfnWndProc = & sig.Events; > >> I get a error type casting in >the following: > >Cannot convert >'long (_stdcall *(_closure)(HWND__*,unsigned > int,UINT,long))(HWND__* hwnd,unsigned int,UINT,long)' >to >'long (_stdcall *)(HWND__* hwnd,unsigned int,UINT,long)' >in function >struct MainWindow::InitInstance(const char*) > >Can someone tell me how do I fix this problem.
Technical Details
Message-ID:
<41a17387$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41a13964@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,874f410c864356cd 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: Help needed in Type Casting Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 24.74.175.102 References: <41a13964@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <41a17387$1@newsgroups.borland.com> Date: 21 Nov 2004 21:05:11 -0700 X-Trace: newsgroups.borland.com 1101099911 207.105.83.66 (21 Nov 2004 21:05:11 -0700) Lines: 48 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail