I am investigating trapping messages by overriding wndproc but I'm now having some problems:
Code:
protected override void WndProc(ref Message m) 
        {        
        // Listen for operating system messages.
            switch (m.Msg)
            {

                case WM_DEVICECHANGE:
                    {                        
                        if (m.WParam.ToInt32() == DBT_DEVICEARRIVAL )//<== Put there to follow the control loop
                            MessageBox.Show("System Device List Changed");                           

                        switch ( dMsg )
                        {
                            case DBT_DEVICEARRIVAL:
                                MessageBox.Show("A device has been docked");
                                break;

                            case DBT_DEVICEREMOVECOMPLETE:
                                MessageBox.Show("A device has been REMOVED");
                                break;

                            default:
                                MessageBox.Show("Unrequired system Message");
                                break;

                        } //end of nested switch statement

                    }
                    break;                                  

            }
            base.WndProc(ref m);
        }//end wndProc
I am trapping the WD_DEVICECHANGE message but not the wParam. I out put the WParam value in my modified code and was getting 7. Can someone tell me why I can't trap the correct wParam?