I had a Windows dialog-based project, which is auto-generated by VS 2013. Now I want to add code to detect usb device insert. I read code sample [refer 1](http://learn.microsoft.com/en-us/windows/desktop/devio/detecting-media-insertion-or-removal). It's a Window Procedure can handle message. I also know I had to associate this WinProc to a WNDCLASS object and call RegisterClass, like sample code [refer 2](https://learn.microsoft.com/en-us/windows/desktop/winmsg/using-window-procedures).

However, my code generated by VS 2013 seems not the case. For example, I can't find a WinMain like ***refer 2***. It begins from a global CWinApp::MyApp object and in the MyApp::InitInstance() creates and opens my main dialog window. I implement details in the dialog implementation.

I don't know how to associate the Window Procedure with my main dialog. Or how can I do in the main dialog when USB inserted the Main\_OnDeviceChange( HWND hwnd, WPARAM wParam, LPARAM lParam ) in ***refer 1*** will be called automatically.