CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: An CALLBACK function could be member of an class ?

    Quote Originally Posted by mesajflaviu View Post
    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
  •  





Click Here to Expand Forum to Full Width

Featured