I’m not aware that there is a way to disable USB related messages. However, I also never saw that there is a dialog which could appear by simply inserting a memory stick. Is there possibly an
\Autorun folder on the memory stick, which runs an application showing a dialog?
Can you send me more information about this dialog (e.g. a screenshot or a short movie if it is showing very shortly)?
To disable dialogs in general you would need to de-register particular windows classes (e.g. the Message Box class). However, this is dangerous. Probably no code expects that opening a message box can fail, so the behavior might be unpredictable.
MessageBoxes don’t close automatically, so the dialog you see is most probably a different dialog.
One way around it could be to define your own application window with the attribute “always on top”. All dialogs wich don’t have this attribute will open, but will not be visible. This is also not really nice, but there’s no way of doing something reasonable for any unknown state.