1

I'm using the SetWindowSubclass(...) method of the Windows API to kind of "hook" messages transmitted to a WinProc that is out of the scope of my application.

My application is made of a core and plugins in DLL.

I've implemented such a Subclass in one of my plugins DLL.

I set the Subclass like this:

class MyPlugin 
{
    private:
        static HWND s_OgrehWnd;
        UINT_PTR m_uIdSubclass; //The ID of the Subclass WinProc
        DWORD_PTR m_pdwRefData; 
        //....

    public:
        void MyPlugin::init();
        LRESULT CALLBACK MyPlugin::windowProcSubclass(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam,    UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
        void MyPlugin::shutdown();
        //....
};


//Set the subclass
void MyPlugin::init()
{
//...
bool resultsc = SetWindowSubclass(
    s_hWnd,
    MultitouchPlugin::windowProcSubclass,
    m_uIdSubclass,
    m_pdwRefData
    );        
//...
}

//The subclass
LRESULT CALLBACK MyPlugin::windowProcSubclass(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam,    UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{ 
    switch(message)
    {
    case WM_GESTURE:
        return MultitouchPlugin::g_cGestureEngine.WndProc(hWnd,wParam,lParam);
        break;
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
}

//Remove the subclass
void MyPlugin::shutdown()
{
    //shutdown called - unregister stuff here
    bool isSublcassed = GetWindowSubclass(s_hWnd, MultitouchPlugin::windowProcSubclass, m_uIdSubclass, &m_pdwRefData);

    if(isSublcassed)
    {
        RemoveWindowSubclass(s_OgrehWnd, MultitouchPlugin::windowProcSubclass, m_uIdSubclass);
    }
}

My problem is that when I quit the application, I can see the process that keeps running on in the 'Windows Task Manager' tool. In debug mode, i've checked that it goes calls RemoveWindowSubclass(), and it does it. If I remove my plugin with this code, there is no zombie process....

Does somebody has an idea about a solution to this problem?

Thanx in advance for the help

matt
  • 1,046
  • 1
  • 13
  • 26

0 Answers0