|
-
January 31st, 2018, 03:51 PM
#3
Re: An CALLBACK function could be member of an class ?
 Originally Posted by mesajflaviu
I am trying to use CDC::EnumObjects method just like this:
Code:
CDC dc;
dc.Attach(hDC);
dc.EnumObjects(OBJ_PEN, EnumObjectHandler, 0);
from here: https://msdn.microsoft.com/en-us/lib...or=-2147217396
and
Code:
BOOL CALLBACK EnumObjectHandler(LPVOID lpLogObject, LPARAM lpData)
{
return TRUE;
}
and it works.
My question is, can I move this function, in an class, as member function (method), but, most important, without changing as static ? Yes, I can put here my trials, but none of them had worked ... perhaps it is not possible what I am trying to do 
Yes, you can.
for example, you can pass the this pointer as a lpData parameter.
Then from within this static Callback function you'll be able to call any of your class members using the passed in this pointer.
Last edited by VictorN; February 1st, 2018 at 02:49 AM.
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|