Results 1 to 5 of 5

Thread: [RESOLVED] error C3867 in my call

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    597

    Resolved [RESOLVED] error C3867 in my call

    Usage:

    Code:
    void NotificationParentWindowDestroyed_HandleDestroyedCallback(HWND hWnd);
    NotificationParentWindowDestroyed* MyCallback;
    
    void ucControl::NotificationParentWindowDestroyed_HandleDestroyedCallback(HWND hwnd)
    {		
    	// ... other stuff
            MyCallback->HookActive = false;  
    }
    
    HWND hwndParentForm = ::GetAncestor(this->m_hWnd, GA_ROOTOWNER);
    MyCallback = new NotificationParentWindowDestroyed(hwndParentForm, NotificationParentWindowDestroyed_HandleDestroyedCallback);
    error C3867: 'ucControl::NotificationParentWindowDestroyed_HandleDestroyedCallback': function call missing argument list; use '&ucControl::NotificationParentWindowDestroyed_HandleDestroyedCallback' to create a pointer to member

    This also got error 'error C2276: '&' : illegal operation on bound member function expression'
    Code:
    MyCallback = new NotificationParentWindowDestroyed(hwndParentForm, &NotificationParentWindowDestroyed_HandleDestroyedCallback);


    Code:
    #include "stdafx.h"
    #include <atlbase.h>
    #include <atlwin.h>
    #include <Windows.h>
    
    class NotificationParentWindowDestroyed : public CWindowImpl<NotificationParentWindowDestroyed>
    {
    public:
        DECLARE_WND_SUPERCLASS(NULL, L"NotificationParentWindowDestroyedClass")
        bool HookActive;
        typedef void (*HandleDestroyedCallback)(HWND);
    
        NotificationParentWindowDestroyed(HWND parentForm, HandleDestroyedCallback callback)
        {
            m_hWnd = parentForm;
            m_DestroyedCallback = callback;
    
            // Attach this object to the parent form's window
            Attach(parentForm);
        }
    
        BEGIN_MSG_MAP(NotificationParentWindowDestroyed)
            MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy)
        END_MSG_MAP()
    
    private:
        HWND m_hWnd;
        HandleDestroyedCallback m_DestroyedCallback;
    
        LRESULT OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
        {
            if (m_DestroyedCallback)
            {
                m_DestroyedCallback(m_hWnd);
            }
    
            // Detach this object when the parent window is destroyed
            Detach();
            bHandled = FALSE;
            return 0;
        }
    };
    
    // Usage:
    void NotificationParentWindowDestroyed_HandleDestroyedCallback(HWND hWnd);
    NotificationParentWindowDestroyed* MyCallback;
    
    void ucControl::NotificationParentWindowDestroyed_HandleDestroyedCallback(HWND hwnd)
    {
        // ... other stuff
        MyCallback->HookActive = false;
    }
    
    HWND hwndParentForm = ::GetAncestor(this->m_hWnd, GA_ROOTOWNER);
    MyCallback = new NotificationParentWindowDestroyed(hwndParentForm, &NotificationParentWindowDestroyed_HandleDestroyedCallback);
    Last edited by DaveDavis; Jan 10th, 2024 at 02:34 AM.

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,518

    Re: error C3867 in my call

    You may have more luck posting this (and your other Q) in the C++ subforum as they're not COM/ActiveX related.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    597

    Re: error C3867 in my call

    Quote Originally Posted by fafalone View Post
    You may have more luck posting this (and your other Q) in the C++ subforum as they're not COM/ActiveX related.
    agreed through it is ATL c++.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    597

    Re: error C3867 in my call

    OK, I close this thread and will more a proper thread.
    Sorry for inconvenience.

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,518

    Re: [RESOLVED] error C3867 in my call

    It's no inconvenience, just trying to help you get your questions seen by those who can help more than I'm able to.

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